X-Git-Url: http://git.ithinksw.org/~kgodey/maayanwich.git/blobdiff_plain/1964943395e77b097c3a252c111a149b4d6ed2a3..c3f9729b3ffa534a9cea5e501859ea0db49f8551:/views.py diff --git a/views.py b/views.py index 23f9269..3b12aec 100644 --- a/views.py +++ b/views.py @@ -40,4 +40,14 @@ def all_sandwich(request): sandwiches = Sandwich.objects.all() except Sandwich.DoesNotExist: raise Http404 + return render_to_response('allsandwiches.html', {'sandwiches': sandwiches,}) + +def newsandwiches(request): + try: + if Sandwich.objects.count() > 5: + sandwiches = Sandwich.objects.order_by('date_made')[:5] + else: + sandwiches = Sandwich.objects.order_by('date_made') + except Sandwich.DoesNotExist: + raise Http404 return render_to_response('allsandwiches.html', {'sandwiches': sandwiches,}) \ No newline at end of file