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

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.
主站蜘蛛池模板: 新泰市| 清河县| 灌阳县| 漠河县| 兴山县| 靖州| 瑞安市| 新丰县| 闸北区| 梅州市| 龙陵县| 澄城县| 怀安县| 阿荣旗| 沁水县| 盖州市| 常熟市| 黄冈市| 汝南县| 双桥区| 彭山县| 吴旗县| 北流市| 鄢陵县| 张家港市| 普陀区| 容城县| 乐亭县| 井陉县| 石景山区| 香港| 大洼县| 调兵山市| 陇西县| 阳东县| 繁峙县| 蓝田县| 定安县| 金坛市| 布拖县| 莫力|