CBV source flow 1, create URL
2. Create a View class
3, As_view method source code
Because our custom attempt class inherits the view class, the As_view function in the URL executes when the project is started, and without this method in our custom function class, we find it in the parent class.
4. View function
5, Dispatch
6. Supplement (Http_method_names)
Execution in the view function in the URL
# ## url (r ' ^login/', View.view),
Apiview Execution Source Parsing
The approximate process for using Apiview is similar to the normal CBV process, but in some key ways Apiview will have some added code to customize your own approach
1. Define URLs
This step is the same as using the view CBV
2. Defining the View class
3. View the As_view in the Apiview class
Apiview still inherits the view class, but there are a few custom methods
4, Apiview own dispatch
Because the As_view method is also the As_view method of the inherited parent view, the next process is the same, except that it executes the Apiview own instance method when the dispatch method is executed.
Apiview the execution of the URL view function
# URL (r ' ^publishes/', views. Publishview.as_view ()), #url (r ' ^publishes/', Apiview.as_view ()), # URL (r ' ^publishes/', Apiview.as_view ()), #url (r ' ^publishes/', View.view),
Rest-framework (apiview) source code