Class-based views are the new way of defining views in Django. They do not replace function-based views. They are just an alternative way to implement views as Python objects instead of functions. There are two advantages they have over function-based views. With a class-based view, different HTTP requests can be mapped to a different function, as opposed to a function-based view where the branching takes place based on the
request.method parameter. Object-oriented techniques can be used to reuse the code component, such as mixins (multiple inheritance).
Although we will be using class-based views for our project, to understand the exact difference between the two, here we will present the code for both.
We will ...