Mercurial > public > sg101
changeset 1080:db8f5b3204b7
Fix Yahoo Group post view for V3 design.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 23 Apr 2016 00:06:32 -0500 |
parents | 75189bd9c4ba |
children | ecb8f07d937b |
files | ygroup/urls.py ygroup/views.py |
diffstat | 2 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ygroup/urls.py Sat Apr 23 00:01:40 2016 -0500 +++ b/ygroup/urls.py Sat Apr 23 00:06:32 2016 -0500 @@ -3,10 +3,8 @@ """ from django.conf.urls import url -from django.views.generic import DetailView -from ygroup.models import Post -from ygroup.views import ThreadIndexView, ThreadView +from ygroup.views import ThreadIndexView, ThreadView, PostView urlpatterns = [ @@ -17,7 +15,6 @@ ThreadView.as_view(), name='ygroup-thread_view'), url(r'^post/(?P<pk>\d+)/$', - DetailView.as_view(model=Post, context_object_name='post', - template_name='ygroup/v3/post.html'), + PostView.as_view(), name='ygroup-post_view'), ]
--- a/ygroup/views.py Sat Apr 23 00:01:40 2016 -0500 +++ b/ygroup/views.py Sat Apr 23 00:06:32 2016 -0500 @@ -3,7 +3,7 @@ """ from django.shortcuts import get_object_or_404 -from django.views.generic import ListView +from django.views.generic import ListView, DetailView from ygroup.models import Thread, Post from core.paginator import DiggPaginator @@ -60,3 +60,14 @@ """ return DiggPaginator(queryset, per_page, body=5, tail=2, margin=3, padding=2, **kwargs) + + +class PostView(DetailView): + model = Post + context_object_name = 'post' + template_name = 'ygroup/v3/post.html' + + def get_context_data(self, **kwargs): + context = super(PostView, self).get_context_data(**kwargs) + context['V3_DESIGN'] = True + return context