Views
Source is located in the generic
, which
we’ll describe here.
Crudlfa+ generic views and mixins.
Crudlfa+ takes views further than Django and are expected to:
- generate their URL definitions and reversions,
- check if a user has permission for an object,
- declare the names of the navigation menus they belong to.
-
class
crudlfap.views.generic.
CreateView
(**kwargs)[source]
View to create a model object.
-
class
crudlfap.views.generic.
DefaultTemplateMixin
[source]
Override for get_template_names to append default_template_name.
This allows to configure “last resort” templates for each class, and thus
to provide a working CRUD out of the box.
-
get_template_names
()[source]
Give a chance to default_template_name.
-
get_title_heading
()[source]
Return text for page heading.
-
get_title_html
()[source]
Return text for HTML title tag.
-
get_title_link
()[source]
Return title attribute for links to this view.
Return title for menu links to this view.
-
class
crudlfap.views.generic.
DeleteAction
[source]
View to delete a model object.
-
class
crudlfap.views.generic.
DeleteView
(**kwargs)[source]
-
class
crudlfap.views.generic.
DetailView
(**kwargs)[source]
Templated model object detail view which takes a field option.
-
get_context_data
(*a, **k)[source]
Insert the single object into the context dict.
-
classmethod
get_urlpath
()[source]
Identify the object by slug or pk in the pattern.
-
class
crudlfap.views.generic.
FormView
(**kwargs)[source]
Base FormView class.
-
class
crudlfap.views.generic.
FormViewMixin
[source]
Mixin for views which have a Form.
-
class
crudlfap.views.generic.
HistoryView
(**kwargs)[source]
-
class
crudlfap.views.generic.
ListDeleteView
(**kwargs)[source]
-
class
crudlfap.views.generic.
ModelFormView
(**kwargs)[source]
-
class
crudlfap.views.generic.
ModelFormViewMixin
[source]
ModelForm ViewMixin using readable
-
message_html
(message)[source]
Add the detail url for form.instance, if possible.
-
class
crudlfap.views.generic.
ModelViewMixin
[source]
Mixin for views using a Model class but no instance.
-
get_queryset
()[source]
Return router.get_queryset() by default, otherwise super().
-
class
crudlfap.views.generic.
ObjectFormView
(**kwargs)[source]
Custom form view on an object.
-
class
crudlfap.views.generic.
ObjectFormViewMixin
[source]
Custom form view mixin on an object.
-
class
crudlfap.views.generic.
ObjectMixin
[source]
Make self.object call and cache self.get_object() automatically.
WHAT A RELIEF
However, if it has a router with the get_object() method, use it.
-
get_object
()[source]
Return router.get_object() by default, otherwise super().
-
object
Return the object, uses get_object() if necessary.
-
object_get
()[source]
Return the object, uses get_object() if necessary.
-
object_set
(value)[source]
Set self.object attribute.
-
class
crudlfap.views.generic.
ObjectView
(**kwargs)[source]
-
class
crudlfap.views.generic.
ObjectViewMixin
[source]
Mixin for views using a Model instance.
-
get_slug_field
()[source]
Replace Django’s get_slug_field with get_url_field.
-
get_urlargs
()[source]
Return list with object’s urlfield attribute.
-
classmethod
get_urlpath
()[source]
Identify the object by slug or pk in the pattern.
-
slug_url_kwarg
Replace Django’s slug_url_kwarg with get_url_field.
-
classmethod
to_url_args
(*args)[source]
Return first arg’s url_field attribute.
-
class
crudlfap.views.generic.
TemplateView
(**kwargs)[source]
TemplateView for CRUDLFA+.
-
class
crudlfap.views.generic.
UpdateView
(**kwargs)[source]
Model update view.
-
class
crudlfap.views.generic.
View
(**kwargs)[source]
Base view for CRUDLFA+.
-
class
crudlfap.views.generic.
ViewMixin
[source]
Base View mixin for CRUDLFA+.
If you have any question about style then find your answers in
DefaultTemplateMixin, otherwise in RoutableViewMixin.