From: Kriti Godey Date: Fri, 23 Apr 2010 16:05:30 +0000 (-0400) Subject: Added an index instead of "all sandwiches", made custom titles for every page. X-Git-Url: http://git.ithinksw.org/~kgodey/maayanwich.git/commitdiff_plain/695fbac5cde9f2b38d3b67247480d7f470754331 Added an index instead of "all sandwiches", made custom titles for every page. --- diff --git a/templates/allsandwiches.html b/templates/allsandwiches.html index 4f3a901..eaaba21 100644 --- a/templates/allsandwiches.html +++ b/templates/allsandwiches.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block title %}All Sandwiches{% endblock %} + {% block content %} {% for s in allsandwiches %}

{{ s.adjective }}

diff --git a/templates/base.html b/templates/base.html index 73161e3..280e209 100644 --- a/templates/base.html +++ b/templates/base.html @@ -34,7 +34,7 @@ {% endfor %}
diff --git a/templates/edituser.html b/templates/edituser.html index 0c49fbc..265bd9b 100644 --- a/templates/edituser.html +++ b/templates/edituser.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block title %}Edit account{% endblock %} + {% block content %}

Edit account

diff --git a/templates/indexsandwiches.html b/templates/indexsandwiches.html new file mode 100644 index 0000000..6f9a01a --- /dev/null +++ b/templates/indexsandwiches.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} + +{% block title %}Sandwich Index{% endblock %} + +{% block content %} +

Index of All Sandwiches

+ {% for s in allsandwiches %} +

{{ s.adjective }}

+ {% endfor %} +{% endblock %} \ No newline at end of file diff --git a/templates/loggedin.html b/templates/loggedin.html index d46c57e..5d4d6b7 100644 --- a/templates/loggedin.html +++ b/templates/loggedin.html @@ -1,7 +1,7 @@ -{% block title %}ERROR!{% endblock %} - {% extends "base.html" %} +{% block title %}ERROR!{% endblock %} + {% block content %}

You are already logged in!

{% endblock %} \ No newline at end of file diff --git a/templates/login.html b/templates/login.html index 73ff730..6e8371d 100644 --- a/templates/login.html +++ b/templates/login.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block title %}Login{% endblock %} + {% block content %}

Login

diff --git a/templates/newuser.html b/templates/newuser.html index e5b6bb3..20d837d 100644 --- a/templates/newuser.html +++ b/templates/newuser.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block title %}Create account{% endblock %} + {% block content %}

Create account

diff --git a/templates/nopermission.html b/templates/nopermission.html index 4305b4a..27cac00 100644 --- a/templates/nopermission.html +++ b/templates/nopermission.html @@ -1,7 +1,7 @@ -{% block title %}ERROR!{% endblock %} - {% extends "base.html" %} +{% block title %}ERROR!{% endblock %} + {% block content %}

You do not have permission to perform this action!

{% endblock %} \ No newline at end of file diff --git a/templates/notloggedin.html b/templates/notloggedin.html index 4fae865..e27ea38 100644 --- a/templates/notloggedin.html +++ b/templates/notloggedin.html @@ -1,7 +1,7 @@ -{% block title %}ERROR!{% endblock %} - {% extends "base.html" %} +{% block title %}ERROR!{% endblock %} + {% block content %}

You are not logged in!

{% endblock %} \ No newline at end of file diff --git a/templates/pleaselogin.html b/templates/pleaselogin.html index 8bbcf2d..8aebb05 100644 --- a/templates/pleaselogin.html +++ b/templates/pleaselogin.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block title %}Please login!{% endblock %} + {% block content %}

You are not logged in.

Login

diff --git a/urls.py b/urls.py index 67695c8..98de04b 100644 --- a/urls.py +++ b/urls.py @@ -3,6 +3,7 @@ import views from django.shortcuts import render_to_response urlpatterns = patterns('', + url(r'^sandwich/index/$', views.index_sandwich, name='index_sandwich'), url(r'^sandwich/add/$', views.add_sandwich, name='add_sandwich'), url(r'^sandwich/all/$', views.all_sandwich, name='all_sandwiches'), url(r'^sandwich/(?P[-\w]+)/edit/', views.edit_user, name='edit_user'), diff --git a/views.py b/views.py index fde9e56..bc4798b 100644 --- a/views.py +++ b/views.py @@ -104,6 +104,13 @@ def all_sandwich(request): except Sandwich.DoesNotExist: raise Http404 return render_to_response('allsandwiches.html', {'allsandwiches': allsandwiches,}, context_instance=RequestContext(request)) + +def index_sandwich(request): + try: + allsandwiches = Sandwich.objects.order_by('adjective') + except Sandwich.DoesNotExist: + raise Http404 + return render_to_response('indexsandwiches.html', {'allsandwiches': allsandwiches,}, context_instance=RequestContext(request)) def sandwich_month(request, year, month):