Browse Source

added ProductView with a rudimentary template

master
Frederic 11 years ago
parent
commit
58cb655203
  1. 2
      cash/models.py
  2. 7
      cash/templates/cash/product_detail.html
  3. 8
      cash/urls.py
  4. 8
      cash/views.py
  5. 3
      lugcash2/urls.py

2
cash/models.py

@ -45,7 +45,7 @@ class Account(models.Model): @@ -45,7 +45,7 @@ class Account(models.Model):
descr += '%dx %s\n' % (amount, product.name)
transaction = Transaction(account=self, subject=BUY_SUBJECT,
amount=total_value, description=descr)
amount=total_value, description=descr)
transaction.save()
return True

7
cash/templates/cash/product_detail.html

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
Name: <i>{{ product.name }}</i><br/>
Preis: <i>{{ product.price }}</i><br/>
Kategorie: <i>{{ product.category }}</i><br/>

8
cash/urls.py

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
from django.conf.urls import patterns, url
from cash import views
urlpatterns = patterns('',
url(r'^product/(?P<pk>\d+)/$', views.ProductView.as_view(), name='product'),
)

8
cash/views.py

@ -1 +1,7 @@ @@ -1 +1,7 @@
# Create your views here.
from django.views import generic
from cash.models import *
class ProductView(generic.DetailView):
model = Product

3
lugcash2/urls.py

@ -14,4 +14,7 @@ urlpatterns = patterns('', @@ -14,4 +14,7 @@ urlpatterns = patterns('',
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
url(r'cash/', include('cash.urls')),
)

Loading…
Cancel
Save