I’m using a CBGV CreateView in a Django project.
I need to add some stuff to the context variable only if the form is invalid.
Is it possible to do that in the form_invalid() somehow?
I know of the get_context_data() method but I don’t know how to check if the form is invalid in that method.
The (populated) form is one of the elements passed in the kwargs to
get_context_data. You can get it from there and callis_valid()on it.