python - 得到断言错误是我的Django(1.8.4)

from rest_framework import serializers
from .models import Stock


class StockSerializer(serializers.ModelSerializer):

    class Meta:

        model = Stock

        #field = ('ticker','volume')
        field = '__all__'

我收到异常值: ("Creating a ModelSerializer without either the 'fields' attribute or the 'exclude' attribute has been deprecated since 3.3.0, and is now disallowed. Add an explicit fields = '__all__' to the StockSerializer serializer.",)

最佳答案

如错误消息所述,所需的属性是带有's'的fields,而不是field