Added an index instead of "all sandwiches", made custom titles for every page.
authorKriti Godey <kriti.godey@gmail.com>
Fri, 23 Apr 2010 16:05:30 +0000 (12:05 -0400)
committerKriti Godey <kriti.godey@gmail.com>
Fri, 23 Apr 2010 16:05:30 +0000 (12:05 -0400)
12 files changed:
templates/allsandwiches.html
templates/base.html
templates/edituser.html
templates/indexsandwiches.html [new file with mode: 0644]
templates/loggedin.html
templates/login.html
templates/newuser.html
templates/nopermission.html
templates/notloggedin.html
templates/pleaselogin.html
urls.py
views.py

index 4f3a901..eaaba21 100644 (file)
@@ -1,5 +1,7 @@
 {% extends "base.html" %}
 
+{% block title %}All Sandwiches{% endblock %}
+
 {% block content %}
                {% for s in allsandwiches %}
                        <h3 class="sandwichtitle">{{ s.adjective }}</h3>
index 73161e3..280e209 100644 (file)
@@ -34,7 +34,7 @@
                                        {% endfor %}
                                </ul>
                                <ul class="newest">
-                                       <li><a href="{% url all_sandwiches %}" class="navlink">All sandwiches</a></li>
+                                       <li><a href="{% url index_sandwich %}" class="navlink">All sandwiches</a></li>
                                </ul>
                        </div>
                        <div id="content">
index 0c49fbc..265bd9b 100644 (file)
@@ -1,5 +1,7 @@
 {% extends "base.html" %}
 
+{% block title %}Edit account{% endblock %}
+
 {% block content %}
        <h1 class="pagetitle">Edit account</h1>
        <form enctype="multipart/form-data" action="{% url edit_user gusername=request.user.username %}" method="post" class="cssform">
diff --git a/templates/indexsandwiches.html b/templates/indexsandwiches.html
new file mode 100644 (file)
index 0000000..6f9a01a
--- /dev/null
@@ -0,0 +1,10 @@
+{% extends "base.html" %}
+
+{% block title %}Sandwich Index{% endblock %}
+
+{% block content %}
+       <h1 class="pagetitle">Index of All Sandwiches</h1>
+               {% for s in allsandwiches %}
+                       <p class="sandnotes"><a href="{{ s.get_absolute_url }}">{{ s.adjective }}</a></p>
+               {% endfor %}
+{% endblock %}
\ No newline at end of file
index d46c57e..5d4d6b7 100644 (file)
@@ -1,7 +1,7 @@
-{% block title %}ERROR!{% endblock %}
-
 {% extends "base.html" %}
 
+{% block title %}ERROR!{% endblock %}
+
 {% block content %}
        <h1 class="pagetitle">You are already logged in!</h1>
 {% endblock %}
\ No newline at end of file
index 73ff730..6e8371d 100644 (file)
@@ -1,5 +1,7 @@
 {% extends "base.html" %}
 
+{% block title %}Login{% endblock %}
+
 {% block content %}
        <h1 class="pagetitle">Login</h1>
        <form enctype="multipart/form-data" action="{% url login %}?{{ request.META.QUERY_STRING }}" method="post" class="cssform">
index e5b6bb3..20d837d 100644 (file)
@@ -1,5 +1,7 @@
 {% extends "base.html" %}
 
+{% block title %}Create account{% endblock %}
+
 {% block content %}
        <h1 class="pagetitle">Create account</h1>
        <form enctype="multipart/form-data" action="{% url signup %}" method="post" class="cssform">
index 4305b4a..27cac00 100644 (file)
@@ -1,7 +1,7 @@
-{% block title %}ERROR!{% endblock %}
-
 {% extends "base.html" %}
 
+{% block title %}ERROR!{% endblock %}
+
 {% block content %}
        <h1 class="pagetitle">You do not have permission to perform this action!</h1>
 {% endblock %}
\ No newline at end of file
index 4fae865..e27ea38 100644 (file)
@@ -1,7 +1,7 @@
-{% block title %}ERROR!{% endblock %}
-
 {% extends "base.html" %}
 
+{% block title %}ERROR!{% endblock %}
+
 {% block content %}
        <h1 class="pagetitle">You are not logged in!</h1>
 {% endblock %}
\ No newline at end of file
index 8bbcf2d..8aebb05 100644 (file)
@@ -1,5 +1,7 @@
 {% extends "base.html" %}
 
+{% block title %}Please login!{% endblock %}
+
 {% block content %}
        <h3 class="error">You are not logged in.</h3>
        <h1 class="pagetitle">Login</h1>
diff --git a/urls.py b/urls.py
index 67695c8..98de04b 100644 (file)
--- 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<gusername>[-\w]+)/edit/', views.edit_user, name='edit_user'),
index fde9e56..bc4798b 100644 (file)
--- 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):