- Building RESTful Python Web Services
- Gastón C. Hillar
- 257字
- 2021-08-20 10:24:27
Test your knowledge
- Under the hoods, the
@api_view
decorator is:- A wrapper that converts a function-based view into a subclass of the
rest_framework.views.APIView
class. - A wrapper that converts a function-based view into a serializer.
- A wrapper that converts a function-based view into a subclass of the
rest_framework.views.api_view
class.
- A wrapper that converts a function-based view into a subclass of the
- The browsable API, a feature included in Django REST Framework that:
- Generates human-friendly JSON output for each resource whenever the request specifies
application/json
as the value for theContent-type
key in the request header. - Generates human-friendly HTML output for each resource whenever the request specifies
text/html
as the value for theContent-type
key in the request header. - Generates human-friendly HTML output for each resource whenever the request specifies
application/json
as the value for theContent-type
key in the request header.
- Generates human-friendly JSON output for each resource whenever the request specifies
- The
rest_framework.serializers.ModelSerializer
class:- Automatically populates both a set of default constraints and a set of default parsers.
- populates both a set of default fields but doesn't automatically populate a set of default validators.
Automatically populates both a set of default fields but doesn't automatically populate a set of default validators. Automatically populates both a set of default fields and a set of default validators.
- The
rest_framework.serializers.ModelSerializer
class:- Provides default implementations for the
get
andpatch
methods. - Provides default implementations for the
get
andput
methods. - Provides default implementations for the
create
andupdate
methods.
- Provides default implementations for the
- The
Serializer
andModelSerializer
classes in Django REST Framework are similar to the following two classes in Django Web Framework:-
Form
andModelForm
classes. -
View
andModelView
classes. -
Controller
andModelController
classes.
-
推薦閱讀
- Visual Basic .NET程序設(shè)計(jì)(第3版)
- 深度實(shí)踐OpenStack:基于Python的OpenStack組件開(kāi)發(fā)
- JavaScript 從入門(mén)到項(xiàng)目實(shí)踐(超值版)
- 深度學(xué)習(xí)經(jīng)典案例解析:基于MATLAB
- Python計(jì)算機(jī)視覺(jué)編程
- Java Web開(kāi)發(fā)技術(shù)教程
- 軟件工程
- C程序設(shè)計(jì)案例教程
- Learning Apache Mahout Classification
- ANSYS Fluent 二次開(kāi)發(fā)指南
- Julia 1.0 Programming Complete Reference Guide
- 編程改變生活:用Python提升你的能力(進(jìn)階篇·微課視頻版)
- Java EE Web應(yīng)用開(kāi)發(fā)基礎(chǔ)
- 人人都能開(kāi)發(fā)RPA機(jī)器人:UiPath從入門(mén)到實(shí)戰(zhàn)
- Solr權(quán)威指南(下卷)