diff options
author | luxagraf <sng@luxagraf.net> | 2019-02-07 09:54:16 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2019-02-07 09:54:16 -0600 |
commit | 27aaf92d26eb75157dcfa923a5d63ea63feeb98c (patch) | |
tree | 8f6213bc0ecd7738ad050dc4454732c4fd210ab1 /app/essays/views.py | |
parent | 3a54cdb85027e4a59ca6d78f5b91dbf7be77afd0 (diff) |
updated stylesheets and added essays
Diffstat (limited to 'app/essays/views.py')
-rw-r--r-- | app/essays/views.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/app/essays/views.py b/app/essays/views.py new file mode 100644 index 0000000..0fdaa63 --- /dev/null +++ b/app/essays/views.py @@ -0,0 +1,56 @@ +from django.views.generic import ListView +from django.views.generic.detail import DetailView +from django.contrib.syndication.views import Feed + + +from .models import Essay, PostType, POST_TYPE + + +class EssayListView(ListView): + model = Essay + + def get_queryset(self, **kwargs): + t = self.request.path.split('/')[1] + type_reverse = dict((v, k) for k, v in POST_TYPE) + self.essay_type = t + qs = Essay.objects.filter(post_type=type_reverse[t]) + return qs + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(EssayListView, self).get_context_data(**kwargs) + context['essay_type'] = PostType.objects.get(slug=self.essay_type) + return context + + +class EntryDetailView(DetailView): + model = Essay + + +class EntryDetailViewTXT(EntryDetailView): + template_name = "essays/entry_detail.txt" + + +''' +class TopicListView(ListView): + template_name = 'archives/src_home.html' + + def queryset(self): + return Post.objects.filter(topics__slug=self.kwargs['slug']) + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(TopicListView, self).get_context_data(**kwargs) + context['topic'] = Topic.objects.get(slug__exact=self.kwargs['slug']) + return context + + +class SrcRSSFeedView(Feed): + title = "luxagraf:src Code and Technology" + link = "/src/" + description = "Latest postings to luxagraf.net/src" + description_template = 'feeds/blog_description.html' + + def items(self): + return Post.objects.filter(status__exact=1).order_by('-pub_date')[:10] +''' |