Skip to content

Commit

Permalink
Tidy form invalid method
Browse files Browse the repository at this point in the history
  • Loading branch information
danjac committed Jan 7, 2021
1 parent 27376a2 commit 507499f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/turbo_response/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ class TurboFormMixin:
has 422 status on invalid"""

def form_invalid(self, form: forms.Form) -> HttpResponse:
response = super().form_invalid(form)
response.status_code = http.HTTPStatus.UNPROCESSABLE_ENTITY
return response
return self.render_to_response(
self.get_context_data(form=form),
status=http.HTTPStatus.UNPROCESSABLE_ENTITY,
)


class TurboFrameResponseMixin:
Expand Down

0 comments on commit 507499f

Please sign in to comment.