# HG changeset patch # User Brian Neal # Date 1461387992 18000 # Node ID db8f5b3204b7ae91626178d35e54d4b311a26627 # Parent 75189bd9c4ba482e10d8095efa917f8e09e8b26a Fix Yahoo Group post view for V3 design. diff -r 75189bd9c4ba -r db8f5b3204b7 ygroup/urls.py --- 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\d+)/$', - DetailView.as_view(model=Post, context_object_name='post', - template_name='ygroup/v3/post.html'), + PostView.as_view(), name='ygroup-post_view'), ] diff -r 75189bd9c4ba -r db8f5b3204b7 ygroup/views.py --- 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