Mercurial > public > sg101
comparison ygroup/views.py @ 1045:5d208c3321ce
First stab at V3 design. WIP.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 07 Feb 2016 20:43:42 -0600 |
parents | ee87ea74d46b |
children | db8f5b3204b7 |
comparison
equal
deleted
inserted
replaced
1043:867e84d18b0f | 1045:5d208c3321ce |
---|---|
18 This generic view displays the list of threads available. | 18 This generic view displays the list of threads available. |
19 | 19 |
20 """ | 20 """ |
21 model = Thread | 21 model = Thread |
22 paginate_by = THREADS_PER_PAGE | 22 paginate_by = THREADS_PER_PAGE |
23 template_name = 'ygroup/v3/thread_list.html' | |
24 | |
25 def get_context_data(self, **kwargs): | |
26 context = super(ThreadIndexView, self).get_context_data(**kwargs) | |
27 context['V3_DESIGN'] = True | |
28 return context | |
23 | 29 |
24 def get_paginator(self, queryset, per_page, **kwargs): | 30 def get_paginator(self, queryset, per_page, **kwargs): |
25 """ | 31 """ |
26 Return an instance of the paginator for this view. | 32 Return an instance of the paginator for this view. |
27 """ | 33 """ |
33 """ | 39 """ |
34 This generic view displays the posts in a thread. | 40 This generic view displays the posts in a thread. |
35 | 41 |
36 """ | 42 """ |
37 context_object_name = "post_list" | 43 context_object_name = "post_list" |
38 template_name = "ygroup/thread.html" | 44 template_name = "ygroup/v3/thread.html" |
39 paginate_by = POSTS_PER_PAGE | 45 paginate_by = POSTS_PER_PAGE |
40 | 46 |
41 def get_queryset(self): | 47 def get_queryset(self): |
42 self.thread = get_object_or_404(Thread, pk=self.args[0]) | 48 self.thread = get_object_or_404(Thread, pk=self.args[0]) |
43 return Post.objects.filter(thread=self.thread) | 49 return Post.objects.filter(thread=self.thread) |
44 | 50 |
45 def get_context_data(self, **kwargs): | 51 def get_context_data(self, **kwargs): |
46 context = super(ThreadView, self).get_context_data(**kwargs) | 52 context = super(ThreadView, self).get_context_data(**kwargs) |
47 context['thread'] = self.thread | 53 context['thread'] = self.thread |
54 context['V3_DESIGN'] = True | |
48 return context | 55 return context |
49 | 56 |
50 def get_paginator(self, queryset, per_page, **kwargs): | 57 def get_paginator(self, queryset, per_page, **kwargs): |
51 """ | 58 """ |
52 Return an instance of the paginator for this view. | 59 Return an instance of the paginator for this view. |