Views¶
- class cruditor.views.Cruditor404View(**kwargs)[source]¶
Bases:
CruditorMixin
,TemplateView
Customized not found page. Needed to add the required cruditor context for properly rendered templates.
- class cruditor.views.Cruditor403View(**kwargs)[source]¶
Bases:
CruditorMixin
,TemplateView
Customized permission denied page. Needed to add the required cruditor context for properly rendered templates.
- class cruditor.views.CruditorListView(**kwargs)[source]¶
Bases:
CruditorMixin
,TemplateView
Enhanced list view backed by django-tables2 and django-filters.
You want to set at least the
model
property. The remaining default property values are just fine for a working output.By providing a alternative
table_class
and/orfilter_class
you can improve the usability of the view even further.- filter_class = None[source]¶
Optional django_filters.FilterSet class to provide filtering capabilities.
- get_context_data(**kwargs)[source]¶
Prepares the context by adding the
table
context variable. If you have configuredfilter_class
, thefilter_form
context variable will be provided too.
- get_queryset()[source]¶
Provide a queryset to fetch data with. If
queryset
is set on the class, the value will be used, if not butmodel
is set, the default manager is used.If both queryset and model is not set, you have to override this method to provide data to display.
- get_table_class()[source]¶
Method to override the used table class. By default, returns
table_class
property if set.If no
table_class``is provided, an ``ImproperlyConfigured
exception is raised.
- get_table_kwargs()[source]¶
Override to provide additional kwargs when initializing the table object.
- get_filter_class()[source]¶
Method to override the used filter class from django_filters. By default, returns
filter_class
property if set.
- get_filter_kwargs()[source]¶
Override to provide additional kwargs when initializing the filterset object.
- class cruditor.views.CruditorAddView(**kwargs)[source]¶
Bases:
CruditorMixin
,FormViewMixin
,CreateView
Enhanced view to add new items using a form view.
- class cruditor.views.CruditorChangeView(**kwargs)[source]¶
Bases:
CruditorMixin
,FormViewMixin
,UpdateView
Enhanced view to edit existing items using a form view.
- success_message = 'The {model} "{object}" was successfully changed.'[source]¶
Message used when a item was changed successfully.
- get_title()[source]¶
Generate a sane title when editing an item using the __str__ representation of a object.
- class cruditor.views.CruditorDeleteView(*args, **kwargs)[source]¶
Bases:
CruditorMixin
,DeleteView
Enhanced view to delete existing items after a confirmation.
- success_message = 'The {model} "{object}" was successfully deleted.'[source]¶
Message used when a item was deleted.
- delete(*args, **kwargs)[source]¶
Call the delete() method on the fetched object and then redirect to the success URL.
- form_valid(request, *args, **kwargs)[source]¶
Call
perform_delete
method and redirect to the success URL with a nice success message. If there are protected related objects, an error message is shown instead with the output offormat_linked_objects
.
- class cruditor.views.CruditorChangePasswordView(**kwargs)[source]¶
Bases:
CruditorMixin
,FormView
Enhanced view to perform password changes in the Cruditor context.
- template_name = 'cruditor/form.html'[source]¶
Template used when rendering the change password form.
- form_class[source]¶
Form used to change the password.
alias of
ChangePasswordForm
- get_form_kwargs()[source]¶
The current user is passed to the provided
form_class
when initializing the change password form.
- class cruditor.views.CruditorLogoutView(**kwargs)[source]¶
Bases:
CruditorMixin
,LogoutView
View to log out the current user. After logging out, a info is displayed.
- template_name = 'cruditor/logout.html'[source]¶
Template used to display the info that the user was logged out.