diff --git a/matecnt/templates/base.html b/matecnt/templates/base.html index 9828ff6..7bf6c73 100644 --- a/matecnt/templates/base.html +++ b/matecnt/templates/base.html @@ -2,7 +2,7 @@ - {% block title %}{% endblock %} + {{ heading }} {% block content %}{% endblock %} diff --git a/matecnt/templates/checkout.html b/matecnt/templates/checkout.html index e3e1891..363300e 100644 --- a/matecnt/templates/checkout.html +++ b/matecnt/templates/checkout.html @@ -1,14 +1,12 @@ {% extends "base.html" %} -{% block title %}{{ heading }}{% endblock %} - {% block content %}

{{ heading }}

-{% for drinker in drinkers %} +{% for drink in drinks %}

- - {{ drinker.name }} + + {{ drink.name }}

{% endfor %} diff --git a/matecnt/templates/drinks.html b/matecnt/templates/drinks.html new file mode 100644 index 0000000..363300e --- /dev/null +++ b/matecnt/templates/drinks.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block content %} +

{{ heading }}

+ +{% for drink in drinks %} +

+ + {{ drink.name }} + +

+{% endfor %} +{% endblock %} diff --git a/matecnt/templates/users.html b/matecnt/templates/users.html new file mode 100644 index 0000000..c03e2e3 --- /dev/null +++ b/matecnt/templates/users.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block content %} +

{{ heading }}

+ +{% for drinker in drinkers %} +

+ + {{ drinker.name }} + +

+{% endfor %} +{% endblock %} diff --git a/matecnt/urls.py b/matecnt/urls.py index 0ee53cc..2645267 100644 --- a/matecnt/urls.py +++ b/matecnt/urls.py @@ -5,5 +5,7 @@ urlpatterns = patterns('', # url(r'^$', 'matemat.views.home', name='home'), # url(r'^blog/', include('blog.urls')), - (r'.*$', 'matecnt.views.checkout'), + #(r'.*$', 'matecnt.views.overview'), + (r'users/.*$', 'matecnt.views.users'), + (r'drinks/.*$', 'matecnt.views.drinks'), ) diff --git a/matecnt/views.py b/matecnt/views.py index b8a3d2e..66255f2 100644 --- a/matecnt/views.py +++ b/matecnt/views.py @@ -5,13 +5,23 @@ from django.template import RequestContext, loader from matecnt.models import Drinker, Drink -def checkout(request): +def users(request): #drinkers = Drinker.objects.all() drinkers = Drinker.objects.order_by('credit')[:5] - template = loader.get_template('checkout.html') + template = loader.get_template('users.html') context = RequestContext(request, { - 'heading': 'It does work.', + 'heading': 'User list', 'drinkers': drinkers, }) return HttpResponse(template.render(context)) + +def drinks(request): + drinks = Drink.objects.order_by('prize') + template = loader.get_template('drinks.html') + + context = RequestContext(request, { + 'heading': 'Drink list', + 'drinks': drinks, + }) + return HttpResponse(template.render(context)) diff --git a/matemat/urls.py b/matemat/urls.py index 11ae66e..3fb4936 100644 --- a/matemat/urls.py +++ b/matemat/urls.py @@ -4,6 +4,6 @@ from django.contrib import admin from matecnt import urls as matecnt_urls urlpatterns = patterns('', - url(r'^checkout/', include(matecnt_urls)), + url(r'^mate/', include(matecnt_urls)), url(r'^admin/', include(admin.site.urls)), )