From 2d9e06ac8fef7fd1399188a98b04c564614f0c6c Mon Sep 17 00:00:00 2001 From: Jason McBrayer Date: Sun, 13 May 2018 13:16:44 -0400 Subject: [PATCH] Fix crash on validation error in replies --- brutaldon/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/brutaldon/views.py b/brutaldon/views.py index fcdfcbc..5f71b2f 100644 --- a/brutaldon/views.py +++ b/brutaldon/views.py @@ -225,9 +225,8 @@ def reply(request, id): 'fullbrutalism': fullbrutalism_p(request)}) elif request.method == 'POST': form = PostForm(request.POST, request.FILES) + mastodon = get_mastodon(request) if form.is_valid(): - # create media objects - mastodon = get_mastodon(request) # create media objects media_objects = [] for index in range(1,5): @@ -244,6 +243,8 @@ def reply(request, id): in_reply_to_id=id) return redirect(thread, id) else: + toot = mastodon.status(id) + context = mastodon.status_context(id) return render(request, 'main/reply.html', {'context': context, 'toot': toot, 'form': form, 'reply': True, 'fullbrutalism': fullbrutalism_p(request)})