Mixins¶
NoLoginRequiredMixin¶
-
class
boilerplate.mixins.NoLoginRequiredMixin[source]¶ Mixin for any class view classes that required the current user if not authenticated, redirects the user to the home page or any URL with the next parameter.
Example
class Register(NoLoginRequiredMixin, FormView): form_class = forms.RegisterForm
CRUDMessageMixin¶
CreateMessageMixin¶
UpdateMessageMixin¶
DeleteMessageMixin¶
ListActionsMixin¶
ExtraFormsAndFormsetsMixin¶
-
class
boilerplate.mixins.ExtraFormsAndFormsetsMixin[source]¶ Mixin for
CreateVieworUpdateViewclasses that adds extra forms and formsets to any of thoose views.Example
class UserUpdate(ExtraFormsAndFormsetsMixin, UpdateView): model = User extra_form_list = ( ('profile', 'user', forms.ProfileForm), ('credit_card', 'user', forms.ProfileForm), ) formset_list = ( (form.AddressFormSet), (form.PhoneFormSet), )
-
form_invalid(form, extra_forms=None, formsets=None)[source]¶ If the form or the extra forms are invalid, re-render the context data with the data-filled form and errors.
-
form_valid(form, extra_forms=None, formsets=None)[source]¶ If the form is valid, redirect to the supplied URL.
-
get_extra_form_kwargs(lookup_field)[source]¶ Returns the keyword arguments for instantiating each extra form.
-
get_extra_form_list()[source]¶ Returns a list of extra forms with the lookup_field, relation_field and form_class to use in this view.
-