+ sandwiches = Sandwich.objects.order_by('-date_made')
+ except Sandwich.DoesNotExist:
+ raise Http404
+ return render_to_response('allsandwiches.html', {'allsandwiches': ms, 'sandwiches': sandwiches, 'user': request.user,})
+
+def current_home(request):
+ temp = Sandwich.objects.order_by('-date_made')[0]
+ curr_month = temp.date_made.month
+ curr_year = temp.date_made.year
+ try:
+ ms = Sandwich.objects.filter(date_made__month=curr_month, date_made__year=curr_year)
+ if Sandwich.objects.count() > 5:
+ sandwiches = Sandwich.objects.order_by('-date_made')[:5]
+ else:
+ sandwiches = Sandwich.objects.order_by('-date_made')