This will be an IndexError if fail does not exist in POST. Use request.POST.get to prevent.