Mercurial > public > sg101
comparison gpp/forums/views/main.py @ 529:7388cdf61b25
For #241, add a URL to view the last post in a forum topic.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 22 Dec 2011 02:10:27 +0000 |
parents | 82b97697312e |
children | 98b373ca09f3 |
comparison
equal
deleted
inserted
replaced
528:311c926dd218 | 529:7388cdf61b25 |
---|---|
285 | 285 |
286 # user isn't authenticated, just go to the topic | 286 # user isn't authenticated, just go to the topic |
287 return HttpResponseRedirect(topic_url) | 287 return HttpResponseRedirect(topic_url) |
288 | 288 |
289 | 289 |
290 def topic_latest(request, id): | |
291 """ | |
292 This view shows the latest (last) post in a given topic. | |
293 | |
294 """ | |
295 topic = get_object_or_404(Topic.objects.select_related(depth=1), pk=id) | |
296 | |
297 if topic.last_post: | |
298 return _goto_post(topic.last_post) | |
299 | |
300 raise Http404 | |
301 | |
302 | |
290 @login_required | 303 @login_required |
291 def new_topic(request, slug): | 304 def new_topic(request, slug): |
292 """ | 305 """ |
293 This view handles the creation of new topics. | 306 This view handles the creation of new topics. |
294 """ | 307 """ |