返回我在序列化程序上收到的字段

时间:2016-07-08 11:43:20

标签: django django-rest-framework django-serializer

我收到的请求如下: 发表建议/

{
    "suggestions": [{
        "description": "Good One!!",
        "integration_type": "External",
    }]
}

我想要归还:

[
  {
    "url": "http://0.0.0.0:8000/suggestion/12",
    "id": 12,
    "date_created": "2016-07-08T11:40:01.582843Z",
    "name": "Coffee!!",
"integration_type": "External",
  }
]

在我的模型中,我有" integration_type",但它没有返回任何内容。它甚至不会出现。

我喜欢这个:

integration_type = serializers.CharField(write_only=True)

我需要确保" integration_type"是在请求,我想也返回它。

有人可以帮助noobie吗?谢谢你的建议

0 个答案:

没有答案