class django.views.generic.edit.FormMixin
A mixin class that provides facilities for creating and displaying forms.
Mixins
Methods and Attributes
-
initial -
A dictionary containing initial data for the form.
-
form_class -
The form class to instantiate.
-
success_url -
The URL to redirect to when the form is successfully processed.
-
prefix -
The
prefixfor the generated form.
-
get_initial() -
Retrieve initial data for the form. By default, returns a copy of
initial.
-
get_form_class() -
Retrieve the form class to instantiate. By default
form_class.
-
get_form(form_class=None) -
Instantiate an instance of
form_classusingget_form_kwargs(). Ifform_classisn’t providedget_form_class()will be used.
-
get_form_kwargs() -
Build the keyword arguments required to instantiate the form.
The
initialargument is set toget_initial(). If the request is aPOSTorPUT, the request data (request.POSTandrequest.FILES) will also be provided.
-
get_prefix() -
Determine the
prefixfor the generated form. Returnsprefixby default.
-
get_success_url() -
Determine the URL to redirect to when the form is successfully validated. Returns
success_urlby default.
-
form_valid(form) -
Redirects to
get_success_url().
-
form_invalid(form) -
Renders a response, providing the invalid form as context.
-
get_context_data(**kwargs) -
New in Django 1.9.
Calls
get_form()and adds the result to the context data with the name ‘form’.
Please login to continue.