- 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.
-
推薦閱讀
- jQuery Mobile Web Development Essentials(Third Edition)
- Python編程自學手冊
- Apache Spark 2.x Machine Learning Cookbook
- Java技術手冊(原書第7版)
- Python王者歸來
- 重學Java設計模式
- Hands-On Swift 5 Microservices Development
- RSpec Essentials
- Windows Phone 7.5:Building Location-aware Applications
- HTML5 APP開發從入門到精通(微課精編版)
- C#開發案例精粹
- 圖數據庫實戰
- Hands-On Kubernetes on Windows
- Java程序設計入門(第2版)
- WCF編程(第2版)