Rest-framework (apiview) source code

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.