git.ithinksw.org
/
~kgodey
/
maayanwich.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cf85775
)
Added month view and url.
author
Kriti Godey
<kriti.godey@gmail.com>
Wed, 3 Mar 2010 21:32:02 +0000
(16:32 -0500)
committer
Kriti Godey
<kriti.godey@gmail.com>
Wed, 3 Mar 2010 21:32:02 +0000
(16:32 -0500)
urls.py
patch
|
blob
|
history
views.py
patch
|
blob
|
history
diff --git
a/urls.py
b/urls.py
index
dd6fede
..
a2a7ff7
100644
(file)
--- a/
urls.py
+++ b/
urls.py
@@
-9,4
+9,5
@@
urlpatterns = patterns('',
(r'^allsandwiches/$', views.all_sandwich),
(r'^newsandwiches/$', views.newsandwiches),
(r'^sandwich/(?P<slug>[-\w]+)/$', views.specific_sandwich),
(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),
)
)
diff --git
a/views.py
b/views.py
index
872104f
..
efced1f
100644
(file)
--- a/
views.py
+++ b/
views.py
@@
-55,6
+55,13
@@
def newsandwiches(request):
raise Http404
return render_to_response('allsandwiches.html', {'sandwiches': sandwiches,})
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:
def specific_sandwich(request, slug):
try: