diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/notes/urls.py | 11 | ||||
-rw-r--r-- | app/notes/views.py | 16 |
2 files changed, 26 insertions, 1 deletions
diff --git a/app/notes/urls.py b/app/notes/urls.py index 00a8cce..0f9fad7 100644 --- a/app/notes/urls.py +++ b/app/notes/urls.py @@ -21,7 +21,16 @@ urlpatterns = [ views.NoteDetailView.as_view(), name="detail" ), - + url( + r'^(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/$', + views.NoteMonthArchiveView.as_view(month_format='%m'), + name="list_month" + ), + url( + r'(?P<year>\d{4})/$', + views.NoteYearArchiveView.as_view(), + name="list_year" + ), url( diff --git a/app/notes/views.py b/app/notes/views.py index b8bc04e..1fbe6f4 100644 --- a/app/notes/views.py +++ b/app/notes/views.py @@ -1,5 +1,6 @@ from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext +from django.views.generic.dates import YearArchiveView, MonthArchiveView from django.views.generic.detail import DetailView from utils.views import PaginatedListView @@ -29,6 +30,21 @@ class NoteDetailViewAMP(NoteDetailView): template_name = "details/entry.amp" +class NoteYearArchiveView(YearArchiveView): + queryset = LuxNote.objects.all() + date_field = "pub_date" + make_object_list = True + allow_future = True + template_name = "archives/notes_date.html" + + +class NoteMonthArchiveView(MonthArchiveView): + queryset = LuxNote.objects.all() + date_field = "pub_date" + allow_future = True + template_name = "archives/notes_date.html" + + """ Legacy Notes views """ |