Added an index instead of "all sandwiches", made custom titles for every page.
[~kgodey/maayanwich.git] / views.py
index 1fd9137..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):
@@ -205,6 +212,8 @@ def edit_user(request, gusername):
                                guser.email = email
                                guser.save()
                                return render_to_response('userchanged.html', context_instance=RequestContext(request)) 
+                       else:
+                               return render_to_response('edituser.html', {'cform': form,}, context_instance=RequestContext(request))
                else:
                        form = NewUserForm(initial={'username': guser.username, 'first_name': guser.first_name, 'last_name': guser.last_name, 'email': guser.email, }) # An unbound form
                        return render_to_response('edituser.html', {'cform': form,}, context_instance=RequestContext(request))