viewhelpers.formview.createview — Create views¶
-
class
CreateViewMixin¶ Bases:
django_cradmin.viewhelpers.formview.create_update_view_mixin.CreateUpdateViewMixinCommon mixin class for create views.
Note
You should import this class with
from django_cradmin import viewhelpers, and refer to it usingviewhelpers.formview.CreateViewMixin.-
editview_appurl_name= 'edit'¶ The viewname within this app for the edit view. See
get_editurl().
-
get_pagetitle()¶ Get the page title (the title tag).
Defaults to
Create <verbose_name model>.
-
get_success_message(obj)¶ Defaults to
"Created "<str(obj)>".
-
get_editurl(obj)¶ Get the edit URL for
obj.Defaults to:
self.request.cradmin_app.reverse_appurl(self.editview_appurl_name, args=[obj.pk])
You normally want to use
get_full_editurl()instead of this method.
-
get_full_editurl(obj)¶ Get the full edit URL for the provided object.
Unlike
get_editurl(), this ensures that anysuccess_urlinrequest.GETis included in the URL.Parameters: obj – A saved model object.
-
-
class
WithinRoleCreateView(**kwargs)¶ Bases:
django_cradmin.viewhelpers.formview.createview.CreateViewMixin,django.views.generic.edit.CreateView,django_cradmin.viewhelpers.mixins.CommonCradminViewMixin,django_cradmin.javascriptregistry.viewmixin.WithinRoleViewMixinCreate view with the correct context data and sane base template for views where we have a cradmin role.
Note
You should import this class with
from django_cradmin import viewhelpers, and refer to it usingviewhelpers.formview.WithinRoleCreateView.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
get_context_data(**kwargs)¶ Insert the form into the context dict.
-