【发布时间】:2020-05-17 06:51:37
【问题描述】:
大家好,我正在使用 rest-freamework 创建一些 API,作为响应,我不想在外国字段中显示 id。
{
"id": 1,
"name": "My Team",
"description": "This is my team",
"dealership": 1,
"users": [
6,
9,
]
}
在改变中,我想要类似的东西:
{
"id": 1,
"name": "My Team",
"description": "This is my team",
"dealership": "Chevrolet Miami",
"users": [
"Jack Black",
"Brad Pitt"
]
}
【问题讨论】:
-
请也写下你的序列化器文件的代码。
标签: django django-rest-framework serialization