diff options
Diffstat (limited to 'app/links/views.py')
-rw-r--r-- | app/links/views.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/app/links/views.py b/app/links/views.py new file mode 100644 index 0000000..36ccca3 --- /dev/null +++ b/app/links/views.py @@ -0,0 +1,33 @@ +from django.views.generic.detail import DetailView +from utils.views import PaginatedListView + +from .models import Link +from taggit.models import Tag + + +class LinkListView(PaginatedListView): + model = Link + template_name = 'archives/links.html' + + +class LinkTagListView(PaginatedListView): + model = Link + template_name = 'archives/links.html' + + def get_queryset(self): + return Link.objects.filter(tags__name=self.kwargs['slug']) + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(LinkTagListView, self).get_context_data(**kwargs) + context['tag'] = Tag.objects.get(slug__exact=self.kwargs['slug']) + return context + +class LinkDetailView(DetailView): + model = Link + template_name = "details/link.html" + slug_field = "id" + + +class LinkDetailViewTXT(LinkDetailView): + template_name = "details/entry.txt" |