代码拉取完成,页面将自动刷新
from rest_framework import serializers
from .models import ListModel
from utils import datasolve
class CustomerGetSerializer(serializers.ModelSerializer):
customer_name = serializers.CharField(read_only=True, required=False)
customer_city = serializers.CharField(read_only=True, required=False)
customer_address = serializers.CharField(read_only=True, required=False)
customer_contact = serializers.CharField(read_only=True, required=False)
customer_manager = serializers.CharField(read_only=True, required=False)
customer_level = serializers.IntegerField(read_only=True, required=False)
creater = serializers.CharField(read_only=True, required=False)
create_time = serializers.DateTimeField(read_only=True, format='%Y-%m-%d %H:%M:%S')
update_time = serializers.DateTimeField(read_only=True, format='%Y-%m-%d %H:%M:%S')
class Meta:
model = ListModel
exclude = ['openid', 'is_delete', ]
read_only_fields = ['id', ]
class CustomerPostSerializer(serializers.ModelSerializer):
openid = serializers.CharField(read_only=False, required=False, validators=[datasolve.openid_validate])
customer_name = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
customer_city = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
customer_address = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
customer_contact = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
customer_manager = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
customer_level = serializers.IntegerField(read_only=False, required=True, validators=[datasolve.data_validate])
creater = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
class Meta:
model = ListModel
exclude = ['is_delete', ]
read_only_fields = ['id', 'create_time', 'update_time', ]
class CustomerUpdateSerializer(serializers.ModelSerializer):
customer_name = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
customer_city = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
customer_address = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
customer_contact = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
customer_manager = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
customer_level = serializers.IntegerField(read_only=False, required=True, validators=[datasolve.data_validate])
creater = serializers.CharField(read_only=False, required=True, validators=[datasolve.data_validate])
class Meta:
model = ListModel
exclude = ['openid', 'is_delete', ]
read_only_fields = ['id', 'create_time', 'update_time', ]
class CustomerPartialUpdateSerializer(serializers.ModelSerializer):
customer_name = serializers.CharField(read_only=False, required=False, validators=[datasolve.data_validate])
customer_city = serializers.CharField(read_only=False, required=False, validators=[datasolve.data_validate])
customer_address = serializers.CharField(read_only=False, required=False, validators=[datasolve.data_validate])
customer_contact = serializers.CharField(read_only=False, required=False, validators=[datasolve.data_validate])
customer_manager = serializers.CharField(read_only=False, required=False, validators=[datasolve.data_validate])
customer_level = serializers.IntegerField(read_only=False, required=False, validators=[datasolve.data_validate])
creater = serializers.CharField(read_only=False, required=False, validators=[datasolve.data_validate])
class Meta:
model = ListModel
exclude = ['openid', 'is_delete', ]
read_only_fields = ['id', 'create_time', 'update_time', ]
class FileRenderSerializer(serializers.ModelSerializer):
customer_name = serializers.CharField(read_only=False, required=False)
customer_city = serializers.CharField(read_only=False, required=False)
customer_address = serializers.CharField(read_only=False, required=False)
customer_contact = serializers.CharField(read_only=False, required=False)
customer_manager = serializers.CharField(read_only=False, required=False)
customer_level = serializers.IntegerField(read_only=False, required=False)
creater = serializers.CharField(read_only=False, required=False)
create_time = serializers.DateTimeField(read_only=True, format='%Y-%m-%d %H:%M:%S')
update_time = serializers.DateTimeField(read_only=True, format='%Y-%m-%d %H:%M:%S')
class Meta:
model = ListModel
ref_name = 'CustomereFileRenderSerializer'
exclude = ['openid', 'is_delete', ]
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。