在尝试将我的 TastyPie 应用程序升级到 Django 1.8 时,但收到错误消息:
Content type for specified type 'html' not found. Please provide it at either the class level or via the arguments.
当在以下 Python 代码中执行 serializer=...
时,会发生这种情况:
class PeopleResource(ModelResource):
movie = fields.ToManyField('movies.api.MovieResource', 'movie', related_name="casts", null=True)
class Meta:
queryset = People.objects.all()
resource_name = 'people'
include_resource_uri = False
always_return_data = True
authorization= Authorization()
serializer = Serializer(formats=['json', 'jsonp', 'xml', 'yaml', 'html', 'plist'])
filtering = {
'name': ALL,
'id': ALL,
}
我不明白在类级别或按参数提供的说明。
最佳答案
关于python - Tastypie 与 Django 1.8 给出内容类型未找到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32593922/