summaryrefslogtreecommitdiff
path: root/app/posts/views
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-08-15 14:09:09 -0400
committerluxagraf <sng@luxagraf.net>2020-08-15 14:09:09 -0400
commit00a432ed481be1f2816499048336f0f055d7786f (patch)
tree3bab7260ed15dd55284ee8178c79f5079aea4ee7 /app/posts/views
parentdf225728281378c7047e1aded2910fbb399b650e (diff)
moved fieldnotes into posts, finished builder for those
Diffstat (limited to 'app/posts/views')
-rw-r--r--app/posts/views/__init__.py19
-rw-r--r--app/posts/views/field_note_views.py38
2 files changed, 57 insertions, 0 deletions
diff --git a/app/posts/views/__init__.py b/app/posts/views/__init__.py
index e69de29..5fd984c 100644
--- a/app/posts/views/__init__.py
+++ b/app/posts/views/__init__.py
@@ -0,0 +1,19 @@
+from django.contrib.syndication.views import Feed
+
+from ..models import Post
+
+class PostRSSFeedView(Feed):
+ title = "Luxagraf: Topographical Writings"
+ link = "https://luxagraf.net/"
+ description = "Latest postings to luxagraf.net"
+ description_template = 'feeds/blog_description.html'
+
+ def items(self):
+ return Post.objects.filter(status__exact=1).order_by('-pub_date')[:10]
+
+ def item_pubdate(self, item):
+ """
+ Takes an item, as returned by items(), and returns the item's
+ pubdate.
+ """
+ return item.pub_date
diff --git a/app/posts/views/field_note_views.py b/app/posts/views/field_note_views.py
new file mode 100644
index 0000000..8b2c78c
--- /dev/null
+++ b/app/posts/views/field_note_views.py
@@ -0,0 +1,38 @@
+from django.views.generic.dates import YearArchiveView, MonthArchiveView
+from django.views.generic.detail import DetailView
+
+from utils.views import PaginatedListView, LuxDetailView
+
+from ..models import Post, PostType
+
+
+class FieldNoteListView(PaginatedListView):
+ model = Post
+ template_name = "posts/fieldnote_list.html"
+ """
+ Return a list of Notes in reverse chronological order
+ """
+ queryset = Post.objects.filter(post_type=PostType.FIELD_NOTE,status=1).order_by('-pub_date')
+
+
+class FieldNoteDetailView(LuxDetailView):
+ model = Post
+ slug_field = "slug"
+
+
+class FieldNoteDetailViewTXT(FieldNoteDetailView):
+ template_name = "posts/entry_detail.txt"
+
+
+class FieldNoteYearArchiveView(YearArchiveView):
+ queryset = Post.objects.filter(post_type=PostType.FIELD_NOTE,status=1)
+ date_field = "pub_date"
+ template_name = "posts/fieldnote_archive_list_date.html"
+ make_object_list = True
+
+
+class FieldNoteMonthArchiveView(MonthArchiveView):
+ queryset = Post.objects.filter(post_type=PostType.FIELD_NOTE,status=1)
+ date_field = "pub_date"
+ make_object_list = True
+ template_name = "posts/fieldnote_archive_list_date.html"