summaryrefslogtreecommitdiff
path: root/app/blog
diff options
context:
space:
mode:
Diffstat (limited to 'app/blog')
-rw-r--r--app/blog/urls.py4
-rw-r--r--app/blog/views.py18
2 files changed, 20 insertions, 2 deletions
diff --git a/app/blog/urls.py b/app/blog/urls.py
index f792527..eb69873 100644
--- a/app/blog/urls.py
+++ b/app/blog/urls.py
@@ -12,8 +12,8 @@ urlpatterns = patterns('',
urlpatterns = patterns('',
url(r'(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[-\w]+)$', 'blog.views.entry_detail'),
- #url(r'(?P<year>\d{4})/(?P<month>\d{2})/$', 'blog.views.date_list', name="blog_by_month"),
- #url(r'(?P<year>\d{4})/$', 'blog.views.date_list', name="blog_by_year"),
+ url(r'(?P<year>\d{4})/(?P<month>\d{2})/$', 'blog.views.date_list', name="blog_by_month"),
+ url(r'(?P<year>\d{4})/$', 'blog.views.date_list', name="blog_by_year"),
(r'(?P<slug>[-\w]+)/(?P<page>\d+)/$', 'blog.views.entry_list_by_area'),
(r'(?P<page>\d+)/$', 'blog.views.entry_list'),
url(r'(?P<slug>[-\w]+)/$', RedirectView.as_view(url="/jrnl/%(slug)s/1/")),
diff --git a/app/blog/views.py b/app/blog/views.py
index be04e6c..c360ef3 100644
--- a/app/blog/views.py
+++ b/app/blog/views.py
@@ -45,6 +45,24 @@ class BlogEntryListView(ListView):
"""
+def date_list(request, year, month=None):
+ import datetime
+ if month:
+ month_name = datetime.datetime.strptime(month,'%m').strftime('%B')
+ context = {
+ 'object_list': Entry.objects.filter(status__exact=1, pub_date__year=year, pub_date__month=month).order_by('pub_date'),
+ 'type': 'monthly',
+ 'year': year,
+ 'month': month_name
+ }
+ else:
+ context = {
+ 'object_list': Entry.objects.filter(status__exact=1, pub_date__year=year).order_by('-pub_date'),
+ 'type': 'year',
+ 'year': year,
+ }
+ return render_to_response("archives/writing_date.html", context, context_instance=RequestContext(request))
+
def entry_list(request, page):
request.page_url = '/jrnl/%d/'