【发布时间】:2015-12-21 12:54:42
【问题描述】:
模型是
class Article(models.Model):
title = models.CharField(max_length=30)
class Categories(models.Model):
article = models.ForeignKey(Article)
name = models.CharField(max_length=30)
有可能使用drf-extensions,如何使用。
如何设置有类似的 URL
/api/article/92285/categories
它应该能够为 GET、POST 和 PUT 提供响应
从以下格式
{
"article_id": 92285,
"views": 0,
"downloads": 0,
"shares": 0,
"handle_url": "",
"title": "Test dataset",
"defined_type": "dataset",
"status": "Drafts",
"published_date": "",
"description": "Test description",
"total_size": 0,
"owner": {
"id": 13483,
"full_name": "John Carter"
},
"authors": [
{
"first_name": "John ",
"last_name": "Carter",
"id": 13483,
"full_name": "John Carter"
}
],
"tags": [
],
"categories": [
{
"id": 135,
"name": "Technology"
},
]
"files": [
]
}
--
【问题讨论】:
标签: django django-rest-framework drf-nested-routers