【发布时间】:2016-04-07 22:54:19
【问题描述】:
EmberData 是POSTing:
{
"data": {
"attributes": {
"name": "The project name",
"description": "The project description",
"price": 123
},
"relationships": {
"onwer": {
"data": null
}
},
"type": "projects"
}
}
而Django(我猜是drf)正在抱怨409 Conflict:
{
"errors": {
"detail": "The resource object's type (projects) is not the type that constitute the collection represented by the endpoint (project)."
}
}
显然JSONApi 规范does not 强制执行变形规则。如何告诉drf 接受该类型的复数形式?
【问题讨论】:
-
如果你的模型是
project类型,你不应该从 Ember 提交这个吗?您不是在创建Projects模型实例,而是在创建Project。 -
@Ashley'CptLemming'Wilson:如前所述,JSONApi 没有指定这一点 - 这是一个实施决定。两种方式都接受,EmberData方式和Django方式冲突。
标签: django ember-data django-rest-framework json-api