summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2016-02-08 13:18:18 -0500
committerluxagraf <sng@luxagraf.net>2016-02-08 13:18:18 -0500
commitee6db3c3dc4dbe8903265fde6e799872dcd0fc71 (patch)
tree2ed524d3d81438219252a803696f731e6fdd56b3 /app
parentfdb951576ff642d160bd66cba82179fa2ca247d7 (diff)
added note month and year archives
Diffstat (limited to 'app')
-rw-r--r--app/notes/urls.py11
-rw-r--r--app/notes/views.py16
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
"""