未找到Django提供内容类型的Tastypie

2024-04-26 17:29:26 发布

您现在位置:Python中文网/ 问答频道 /正文

尝试将我的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,
        }

我不理解在类级或参数级提供的指令)。你知道吗


Tags: thedjangonametrue应用程序消息htmltype