views.generic.edit.CreateView.object

object When using CreateView you have access to self.object, which is the object being created. If the object hasn’t been created yet, the value will be None. Example myapp/views.py: from django.views.generic.edit import CreateView from myapp.models import Author class AuthorCreate(CreateView): model = Author fields = ['name'] Example myapp/author_form.html: <form action="" method="post">{% csrf_token %} {{ form.as_p }} <input type="submit" value="Save" /> </

views.generic.edit.CreateView.template_name_suffix

template_name_suffix The CreateView page displayed to a GET request uses a template_name_suffix of '_form'. For example, changing this attribute to '_create_form' for a view creating objects for the example Author model would cause the default template_name to be 'myapp/author_create_form.html'.

views.generic.edit.DeleteView

class django.views.generic.edit.DeleteView A view that displays a confirmation page and deletes an existing object. The given object will only be deleted if the request method is POST. If this view is fetched via GET, it will display a confirmation page that should contain a form that POSTs to the same URL. Ancestors (MRO) This view inherits methods and attributes from the following views: django.views.generic.detail.SingleObjectTemplateResponseMixin django.views.generic.base.TemplateRespons

views.generic.edit.DeleteView.template_name_suffix

template_name_suffix The DeleteView page displayed to a GET request uses a template_name_suffix of '_confirm_delete'. For example, changing this attribute to '_check_delete' for a view deleting objects for the example Author model would cause the default template_name to be 'myapp/author_check_delete.html'. Example myapp/views.py: from django.views.generic.edit import DeleteView from django.urls import reverse_lazy from myapp.models import Author class AuthorDelete(DeleteView): model =

views.generic.edit.DeletionMixin

class django.views.generic.edit.DeletionMixin Enables handling of the DELETE http action. Methods and Attributes success_url The url to redirect to when the nominated object has been successfully deleted. success_url may contain dictionary string formatting, which will be interpolated against the object’s field attributes. For example, you could use success_url="/parent/{parent_id}/" to redirect to a URL composed out of the parent_id field on a model. get_success_url() Returns the u

views.generic.edit.DeletionMixin.get_success_url()

get_success_url() Returns the url to redirect to when the nominated object has been successfully deleted. Returns success_url by default.

views.generic.edit.DeletionMixin.success_url

success_url The url to redirect to when the nominated object has been successfully deleted. success_url may contain dictionary string formatting, which will be interpolated against the object’s field attributes. For example, you could use success_url="/parent/{parent_id}/" to redirect to a URL composed out of the parent_id field on a model.

views.generic.edit.FormMixin

class django.views.generic.edit.FormMixin A mixin class that provides facilities for creating and displaying forms. Mixins django.views.generic.base.ContextMixin 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 prefix for the generated form. get_initial() Retrieve initial data for the form. By default, r

views.generic.edit.FormMixin.form_class

form_class The form class to instantiate.

views.generic.edit.FormMixin.form_invalid()

form_invalid(form) Renders a response, providing the invalid form as context.