(r'^allsandwiches/$', views.all_sandwich),
(r'^newsandwiches/$', views.newsandwiches),
(r'^sandwich/(?P<slug>[-\w]+)/$', views.specific_sandwich),
+ (r'^sandwich/(?P<year>[-\w]+)/(?P<month>[-\w]+)/$', views.sandwich_month),
)
raise Http404
return render_to_response('allsandwiches.html', {'sandwiches': sandwiches,})
+def sandwich_month(request, year, month):
+ try:
+ sandwiches = Sandwich.objects.filter(date_made__month=month, date_made__year=year)
+ except Sandwich.DoesNotExist:
+ raise Http404
+ return render_to_response('allsandwiches.html', {'sandwiches': sandwiches,})
+
def specific_sandwich(request, slug):
try: