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

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.
主站蜘蛛池模板: 来凤县| 重庆市| 云阳县| 运城市| 松原市| 彰武县| 青州市| 桐乡市| 鱼台县| 鸡西市| 清水河县| 建昌县| 迁西县| 邵阳县| 鄂托克前旗| 兴化市| 攀枝花市| 涟水县| 益阳市| 马公市| 鹰潭市| 凯里市| 且末县| 正蓝旗| 夏津县| 仪陇县| 武邑县| 邵武市| 沐川县| 开江县| 儋州市| 台东县| 桦甸市| 通山县| 苍梧县| 新丰县| 如皋市| 巢湖市| 肥城市| 东宁县| 松溪县|