官术网_书友最值得收藏!

Test your knowledge

  1. Under the hoods, the @api_view decorator is:
    1. A wrapper that converts a function-based view into a subclass of the rest_framework.views.APIView class.
    2. A wrapper that converts a function-based view into a serializer.
    3. A wrapper that converts a function-based view into a subclass of the rest_framework.views.api_view class.
  2. The browsable API, a feature included in Django REST Framework that:
    1. Generates human-friendly JSON output for each resource whenever the request specifies application/json as the value for the Content-type key in the request header.
    2. Generates human-friendly HTML output for each resource whenever the request specifies text/html as the value for the Content-type key in the request header.
    3. Generates human-friendly HTML output for each resource whenever the request specifies application/json as the value for the Content-type key in the request header.
  3. The rest_framework.serializers.ModelSerializer class:
    1. Automatically populates both a set of default constraints and a set of default parsers.
    2. 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.

  4. The rest_framework.serializers.ModelSerializer class:
    1. Provides default implementations for the get and patch methods.
    2. Provides default implementations for the get and put methods.
    3. Provides default implementations for the create and update methods.
  5. The Serializer and ModelSerializer classes in Django REST Framework are similar to the following two classes in Django Web Framework:
    1.  Form and ModelForm classes.
    2.  View and ModelView classes.
    3.  Controller and ModelController classes.
主站蜘蛛池模板: 嵊泗县| 察哈| 荥经县| 墨竹工卡县| 彰武县| 靖西县| 荆州市| 怀化市| 会泽县| 正镶白旗| 克东县| 措勤县| 遵义县| 临清市| 长寿区| 高陵县| 富民县| 封丘县| 龙江县| 昌宁县| 类乌齐县| 崇明县| 荔浦县| 昂仁县| 手机| 策勒县| 万源市| 台州市| 西贡区| 土默特左旗| 中西区| 罗定市| 娱乐| 武汉市| 澄城县| 鄢陵县| 南川市| 静乐县| 潞城市| 三门县| 东安县|