Mercurial > public > sg101
diff gpp/forums/views.py @ 102:e67c4dd98db5
Forums: new topic form sprouts boolean fields for sticky and locking if the user has rights. Implemented the locked logic. Fixed a bug where topics where getting out of order (the view_count was bumping the update_date because of auto_now).
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 16 Sep 2009 02:01:57 +0000 |
parents | 4bbb6a9aa317 |
children | 59688577a8f1 |
line wrap: on
line diff
--- a/gpp/forums/views.py Wed Sep 16 00:39:27 2009 +0000 +++ b/gpp/forums/views.py Wed Sep 16 02:01:57 2009 +0000 @@ -134,13 +134,13 @@ return HttpResponseForbidden() if request.method == 'POST': - form = NewTopicForm(request.POST) + form = NewTopicForm(request.user, forum, request.POST) if form.is_valid(): - topic = form.save(forum, request.user, request.META.get("REMOTE_ADDR")) + topic = form.save(request.META.get("REMOTE_ADDR")) return HttpResponseRedirect(reverse('forums-new_topic_thanks', kwargs={'tid': topic.pk})) else: - form = NewTopicForm() + form = NewTopicForm(request.user, forum) return render_to_response('forums/new_topic.html', { 'forum': forum, @@ -175,7 +175,7 @@ form = PostForm(request.POST) if form.is_valid(): - if not form.topic.forum.category.can_access(request.user): + if form.topic.locked or not form.topic.forum.category.can_access(request.user): return HttpResponseForbidden() post = form.save(request.user, request.META.get("REMOTE_ADDR"))