summaryrefslogtreecommitdiff
path: root/app/blog/views.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2019-05-03 11:38:24 -0500
committerluxagraf <sng@luxagraf.net>2019-05-03 11:38:24 -0500
commit0e59ad7de18bffcf6a62f9ee61275b4951c27358 (patch)
tree514fca6efb90db53ca3061aa4ab8ba7d2a33cffe /app/blog/views.py
parent86fcf7ed710f41fc5324b638d092af54f4bb756f (diff)
finished up initial design work
Diffstat (limited to 'app/blog/views.py')
-rw-r--r--app/blog/views.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/app/blog/views.py b/app/blog/views.py
index 56bd823..cf0fdf6 100644
--- a/app/blog/views.py
+++ b/app/blog/views.py
@@ -1,9 +1,13 @@
+from operator import attrgetter
+from itertools import chain
from django.views.generic import ListView
from django.views.generic.detail import DetailView
+from django.views.generic.dates import YearArchiveView, MonthArchiveView
from django.contrib.syndication.views import Feed
from .models import Entry
+from links.models import Link
class EntryListView(ListView):
@@ -22,6 +26,36 @@ class EntryDetailViewTXT(EntryDetailView):
template_name = "entry_detail.txt"
+class EntryYearArchiveView(YearArchiveView):
+ queryset = Entry.objects.filter(status__exact=1).select_related()
+ date_field = "pub_date"
+ make_object_list = True
+ allow_future = True
+
+
+class EntryMonthArchiveView(MonthArchiveView):
+ queryset = Entry.objects.filter(status__exact=1).select_related()
+ date_field = "pub_date"
+ allow_future = True
+
+
+class HomePageView(ListView):
+ model = Entry
+ template_name = "homepage.html"
+
+ def get_queryset(self, **kwargs):
+ entry_list = Entry.objects.filter(status=1)
+ link_list = Link.objects.filter(status=1)
+ result_list = sorted(
+ chain(entry_list, link_list),
+ key=attrgetter('pub_date')
+ )
+ return reversed(result_list)
+
+
+
+
+
'''
class TopicListView(ListView):
template_name = 'archives/src_home.html'