- 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.
-
推薦閱讀
- 大學計算機基礎(第二版)
- 編程的修煉
- Raspberry Pi for Secret Agents(Third Edition)
- NumPy Essentials
- Apache Mesos Essentials
- 程序設計基礎教程:C語言
- R Data Analysis Cookbook(Second Edition)
- 21天學通C++(第5版)
- Python 3.7從入門到精通(視頻教學版)
- Mastering Embedded Linux Programming
- Node.js 6.x Blueprints
- Design Patterns and Best Practices in Java
- 跟小樓老師學用Axure RP 9:玩轉產品原型設計
- Android項目實戰:博學谷
- Getting Started with Backbone Marionette