Django Class Based Views

From Django 1.3, The concept of class based views has come up. In this way, view functions are replaced by Python objects.
Specific HTTP methods can be determined by separate methods and can be used more like object-based techniques (mixins).

Class Based Views

First, let’s see the difference between the function and method in Python with an example.:

Let’s run the method:


Execute function:



For an HTTP GET on Django , a view function looks like this:

While in CBV (class-based views) :


Get and post methods in CBV:
On a CBV, the arguments of the Get and POST method are self, request (HttpRequest), and the request argument you specify in Urlconfig.:


Soap 2 day