我有一个简单的产品模型:
class Product(models.Model):
title = models.CharField(max_length=120)
price = models.IntegerField()
如何使用以下属性在Django-Rest-Framework JSON数据中制作:
{
"title": "Product",
"price": "100",
"properties": {
"title": {
"description": "The unique name for a product",
"type": "string"
},
"price": {
"description": "Price of the product",
"type": "integer"
}
},
"required": [ "productId", "productName" ]
}