About Lesson
1. ListView
ListView
is a CBV designed to display a list of objects from the database.
Example:
- model: Specifies the model whose data will be displayed.
- template_name: The name of the template to render.
- context_object_name: The context variable name used in the template to access the list of objects.
Template:
2. DetailView
DetailView
is used to display details of a single object.
Example:
- model: Specifies the model whose single instance will be displayed.
- template_name: The template used to render the details.
Template:
3. CreateView
CreateView
is a CBV used to handle form submissions for creating new records in the database.
Example:
- fields: A list of fields to include in the form.
- success_url: The URL to redirect to upon successful submission.
4. UpdateView
UpdateView
is used for updating an existing record.
Example:
5. DeleteView
DeleteView
is used to handle deletion of records.
Example:
- reverse_lazy: This is used to delay URL resolution until all URLs are loaded.