Redirect invalid reviews back to book page

Works on #17
This commit is contained in:
Mouse Reeve 2020-02-18 23:09:22 -08:00
parent bca0a1f32c
commit efd93855d9

View file

@ -238,10 +238,10 @@ def shelve(request, username, shelf_id, book_id, reshelve=True):
def review(request):
''' create a book review note '''
form = forms.ReviewForm(request.POST)
book_identifier = request.POST.get('book')
# TODO: better failure behavior
if not form.is_valid():
return redirect('/')
book_identifier = request.POST.get('book')
return redirect('/book/%s' % book_identifier)
# TODO: validation, htmlification
name = form.data.get('name')