Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json 生成的rest api没有count或results属性_Json_Django_Rest_Django Rest Framework - Fatal编程技术网

Json 生成的rest api没有count或results属性

Json 生成的rest api没有count或results属性,json,django,rest,django-rest-framework,Json,Django,Rest,Django Rest Framework,我使用django rest framework创建了一个api,但是呈现的api不包含count、result或next或null属性,这些属性可用于访问循环中的几个字段。看起来是这样的- [ { "url": "http://127.0.0.1:8000/app/clubs/1/persons/", "id": 1, "club_name": "club1", "persons": [ 1, 2 ] }, { "

我使用
django rest framework
创建了一个api,但是呈现的api不包含
count
result
next
null
属性,这些属性可用于访问循环中的几个字段。看起来是这样的-

[
{
    "url": "http://127.0.0.1:8000/app/clubs/1/persons/",
    "id": 1,
    "club_name": "club1",
    "persons": [
        1,
        2
    ]
},
{
    "url": "http://127.0.0.1:8000/app/clubs/2/persons/",
    "id": 2,
    "club_name": "club2",
    "persons": [
        1,
        4
    ]
},
]
但是网络上的所有教程都有一个带有这些属性的api。我想通过一个循环访问俱乐部的所有属性。有什么我遗漏的吗?

您需要为您的API进行设置


请注意,API已更改,一些帖子可能与当前API不符。

我无法从文档中收集到太多信息。大部分内容看起来像是下一个和上一个,而我更关心的是如何获得
计数
结果:
键。你能不能给我一个提示,或者改变序列化程序的响应,使其包含count/results/next/previous,如文档所示。我只是不明白是什么阻止了你使用它们。