Mercurial > public > sg101
comparison gpp/news/views.py @ 204:b4305e18d3af
Resolve ticket #74. Add user badges. Some extra credit was done here: also refactored how pending news, links, and downloads are handled.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 01 May 2010 21:53:59 +0000 |
parents | 2baadae33f2e |
children | da46e77cd804 |
comparison
equal
deleted
inserted
replaced
203:40e5903903e1 | 204:b4305e18d3af |
---|---|
55 context_instance = RequestContext(request)) | 55 context_instance = RequestContext(request)) |
56 | 56 |
57 ####################################################################### | 57 ####################################################################### |
58 | 58 |
59 def archive_index(request): | 59 def archive_index(request): |
60 dates = Story.objects.dates('date_published', 'month', order='DESC') | 60 dates = Story.objects.dates('date_submitted', 'month', order='DESC') |
61 return render_to_response('news/archive_index.html', { | 61 return render_to_response('news/archive_index.html', { |
62 'title': 'News Archive', | 62 'title': 'News Archive', |
63 'dates': dates, | 63 'dates': dates, |
64 'search_form': SearchNewsForm(), | 64 'search_form': SearchNewsForm(), |
65 }, | 65 }, |
66 context_instance = RequestContext(request)) | 66 context_instance = RequestContext(request)) |
67 | 67 |
68 ####################################################################### | 68 ####################################################################### |
69 | 69 |
70 def archive(request, year, month, page=1): | 70 def archive(request, year, month, page=1): |
71 stories = Story.objects.filter(date_published__year=year, date_published__month=month) | 71 stories = Story.objects.filter(date_submitted__year=year, date_submitted__month=month) |
72 paginator = create_paginator(stories) | 72 paginator = create_paginator(stories) |
73 try: | 73 try: |
74 the_page = paginator.page(int(page)) | 74 the_page = paginator.page(int(page)) |
75 except InvalidPage: | 75 except InvalidPage: |
76 raise Http404 | 76 raise Http404 |
142 cat_qual = '' | 142 cat_qual = '' |
143 | 143 |
144 stories = stories.filter( | 144 stories = stories.filter( |
145 Q(title__icontains=query_text) | | 145 Q(title__icontains=query_text) | |
146 Q(short_text__icontains=query_text) | | 146 Q(short_text__icontains=query_text) | |
147 Q(long_text__icontains=query_text)).order_by('-date_published') | 147 Q(long_text__icontains=query_text)).order_by('-date_submitted') |
148 | 148 |
149 paginator = create_paginator(stories) | 149 paginator = create_paginator(stories) |
150 try: | 150 try: |
151 the_page = paginator.page(int(page)) | 151 the_page = paginator.page(int(page)) |
152 except InvalidPage: | 152 except InvalidPage: |