我正在研究 Django 和 Swagger。我为用户模型构建了更新方法。但 Swagger 没有在表单中显示“数据”字段,请帮助我。
class UserSerializer(serializers.ModelSerializer):
label = "Users"
allow_null = False[![enter image description here][1]][1]
class Meta(object):
model = User
fields = ('id', 'email', 'first_name', 'last_name', 'is_superuser', 'is_active', 'is_staff', 'position',
'company')
read_only_fields = ['email']
def update(self, instance, validated_data):
"""
This text is the description for this API
param1 -- A first parameter
param2 -- A second parameter
"""
return instance