Base view for creating objects.
This class inherits from:
This implements all logic for creating objects, but does not implement the rendering of responses. See CreateView for an usage example.
Handler for GET requests.
This will set self.object to None.
Returns: | Output returned by ProcessFormMixin.get(). |
---|
Handler for POST requests.
This will set self.object to None.
Returns: | Output returned by ProcessFormMixin.post(). |
---|
View for creating objects.
This class inherits from:
This implements all logic for creating objects, including the rendering of a template. Usage example:
class PostCreateView(CreateView):
form_class = PostForm
document_class = Post
template_name = 'post_form.html'
def get_success_url(self):
return url_for('posts.index')
Base view for updating objects.
This class inherits from:
This implements all logic for retrieving the object for updating and processing the form. This does not implement rendering the responses. See UpdateView for an usage example.
Handler for GET requests.
Handler for POST requests.
View for updating objects.
This class inherits from:
This implements all logic for retrieving the object for updating and processing the form. As well this implements the rendering of a template. Usage example:
class PostUpdateView(UpdateView):
form_class = PostForm
document_class = Post
template_name = 'post_form.html'
def get_success_url(self):
url_for('posts.index')
See also
SingleObjectMixin.get_fields for more information about how the object is retrieved from the database.
Mixin for handling model-form processing.
This class inherits from:
Handle a valid form submission.
When editing an object, the object will be updated and saved, else a new object will be created and saved.
Returns: | Output returned by FormMixin.form_valid(). |
---|
Return context data for rendering template.
This adds self.object as object to the context data returned by FormMixin.get_context_data().
Returns: | A dict containing the context data. |
---|
Return parameters for creating the form instance.
This adds a model instance (or None) to the form parameters returned by FormMixin.get_form_kwargs().
Returns: | A dict containing the arguments for creating the form instance. |
---|