diff --git a/boards/views/__init__.py b/boards/views/__init__.py --- a/boards/views/__init__.py +++ b/boards/views/__init__.py @@ -183,12 +183,12 @@ def thread(request, post_id, mode=MODE_N postFormClass = PostForm kwargs = {} + opening_post = get_object_or_404(Post, id=post_id) if request.method == 'POST': form = postFormClass(request.POST, request.FILES, error_class=PlainErrorList, **kwargs) form.session = request.session - opening_post = get_object_or_404(Post, id=post_id) if form.is_valid(): return _new_post(request, form, opening_post) if form.need_to_ban: @@ -197,7 +197,7 @@ def thread(request, post_id, mode=MODE_N else: form = postFormClass(error_class=PlainErrorList, **kwargs) - thread_to_show = get_object_or_404(Post, id=post_id).thread_new + thread_to_show = opening_post.thread_new context = _init_default_context(request) diff --git a/neboard/settings.py b/neboard/settings.py --- a/neboard/settings.py +++ b/neboard/settings.py @@ -223,19 +223,25 @@ POSTING_DELAY = 20 # seconds COMPRESS_HTML = True -def custom_show_toolbar(request): - return DEBUG - -DEBUG_TOOLBAR_CONFIG = { - 'INTERCEPT_REDIRECTS': False, - 'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar, - 'HIDE_DJANGO_SQL': False, - 'ENABLE_STACKTRACES': True, -} - # Debug mode middlewares if DEBUG: MIDDLEWARE_CLASSES += ( 'boards.profiler.ProfilerMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware', ) + + def custom_show_toolbar(request): + return DEBUG + + DEBUG_TOOLBAR_CONFIG = { + 'INTERCEPT_REDIRECTS': False, + 'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar, + 'HIDE_DJANGO_SQL': False, + 'ENABLE_STACKTRACES': True, + } + + # FIXME Uncommenting this fails somehow. Need to investigate this + #DEBUG_TOOLBAR_PANELS += ( + # 'debug_toolbar.panels.profiling.ProfilingDebugPanel', + #) +