Introduction to Generic Views
In this video, we are going to learn about generic views.
-
In Django, Generic Views are class based view. They take certain common idioms and patterns found in view development and abstract them so that you can quickly write common views of data without having to write too much code.
-
Generic Views offers several advantages, such as code reuse, easier composition, and better organization of view-related logic.
-
Django provides a variety of generic view classes, each designed to handle a specific type of functionality. Some of the commonly used generic view classes are ListView, DetailView, CreateView, UpdateView and DeleteView
-
Here, ListView is used to display a list of objects.
-
DetailView is used to display the details of a single object.
-
CreateView is used to handle the creation of new objects.
-
UpdateView is used to handle updating existing objects.
-
DeleteView is used to handle the deletion of objects.
I hope you have got some general idea of what is generic view. You will understand more in depth once we start writing the code.