Compare View

switch
from
...
to
 
Commits (2)
forum/views/topic.py
... ... @@ -49,6 +49,7 @@ def get_view(request, topic_id, errors=None):
49 49 topic = Topic.objects.get_topic_by_topic_id(topic_id)
50 50 except Topic.DoesNotExist:
51 51 raise Http404
  52 +
52 53 user = request.user
53 54 if user.is_authenticated():
54 55 counter = {
... ... @@ -151,7 +152,7 @@ def post_view(request, topic_id):
151 152 reputation = reputation + 2 * math.log(user.reputation or 0 + topic_time_diff.days + 10, 10)
152 153 ForumUser.objects.filter(pk=topic.author.id).update(reputation=reputation)
153 154  
154   - return redirect('/t/%s/#reply%s' % (topic.id, topic.reply_count + 1))
  155 + return get_view(request, topic_id, errors=form.errors)
155 156  
156 157  
157 158 @login_required
... ...
... ... @@ -94,7 +94,6 @@ TEMPLATE_LOADERS = (
94 94 )
95 95  
96 96 MIDDLEWARE_CLASSES = (
97   - 'django.middleware.cache.UpdateCacheMiddleware', # 缓存中间件,必须放在开头
98 97 'django.middleware.common.CommonMiddleware',
99 98 'django.contrib.sessions.middleware.SessionMiddleware',
100 99 'django.middleware.csrf.CsrfViewMiddleware', # 开启了CSRF,记得在POST表单中加{% csrf_token %},使用RequestContext
... ...