Django and drf source view resolution

Django and drf source view resolution

Analysis of a native Django CBV Source:. View

"""
1) as_view () is an inlet, to obtain view function address
2) a request to view the call function, call the dispatch function to complete the internal distribution request
3) dispatch function mapped to the request method of the view class of the same name, complete processing request, the response obtained
4) then returns the corresponding results of a layer
"""

Two .drf CBV source code analysis: APIView

"""
1) as_view () is an inlet, to give the function address view, partially disabled csrf authentication function address in the range of view
2) request the view function call, internal call () function dispatch completion request class distribution APIView
3) dispatch function of the second package request, after the completion of three authentication request and then mapped to the method of the view class of the same name, the request processing is completed, to give the corresponding, again to do rendering processing corresponding
4) then results returned in response to a layer
"""

Three, DRF framework APIView request lifecycle

 

Four .drf rendering module

Guess you like

Origin www.cnblogs.com/baohanblog/p/12325440.html