模型是
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": [
]
}
--