##// END OF EJS Templates
Moved login view to a separate class. Refactored thread and all threads views
Moved login view to a separate class. Refactored thread and all threads views

File last commit:

r542:8b7899f5 1.7-dev
r544:5f217adc 1.7-dev
Show More
tag_threads.py
27 lines | 729 B | text/x-python | PythonLexer
from django.shortcuts import get_object_or_404
from boards.models import Tag, Post
from boards.views.all_threads import AllThreadsView, DEFAULT_PAGE
__author__ = 'neko259'
class TagView(AllThreadsView):
tag_name = None
def get_threads(self):
tag = get_object_or_404(Tag, name=self.tag_name)
return tag.threads.filter(archived=False)
def get_context_data(self, **kwargs):
context = super(TagView, self).get_context_data(**kwargs)
tag = get_object_or_404(Tag, name=self.tag_name)
context['tag'] = tag
return context
def get(self, request, tag_name, page=DEFAULT_PAGE):
self.tag_name = tag_name
return super(TagView, self).get(request, page)