Class-Based Views
Django provides different ways in which developers can write views for their applications. One way is to map a Python function to act as a view function to create FBVs. Another way of creating views is to use Python object instances (which are based on top of Python classes). These are known as CBVs. An important question that arises is, what is the need for a CBV when we can already create views using the FBV approach?
The idea here, when creating FBVs, is that at times, we may be replicating the same logic again and again, for example, the processing of certain fields, or logic for handling certain request types. Although it is completely possible to create logically separate functions that handle a particular piece of logic, the task becomes difficult to manage as the complexity of the application increases.
This is where CBVs come in handy, where they abstract away implementation of the common repetitive code that we need to write to handle certain tasks...