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

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.
主站蜘蛛池模板: 临高县| 濮阳县| 鹤岗市| 大姚县| 贵南县| 彩票| 通辽市| 张家口市| 肇州县| 昭平县| 南岸区| 东莞市| 潜江市| 于都县| 舒城县| 吉木乃县| 铜川市| 安新县| 乐都县| 淮阳县| 抚顺市| 岳池县| 道真| 九龙县| 临澧县| 托克逊县| 克东县| 桐庐县| 乐昌市| 南投县| 宜兴市| 太康县| 华容县| 荆门市| 水城县| 秦安县| 崇礼县| 栾城县| 平定县| 莱芜市| 临澧县|