feat: quastat sflog create 不需要 belong_dept

This commit is contained in:
caoqianming 2023-06-26 16:49:16 +08:00
parent 51737bcdd8
commit 13b0204c6b
1 changed files with 3 additions and 1 deletions

View File

@ -31,8 +31,10 @@ class QuaStatSfLogSerializer(CustomModelSerializer):
class Meta:
model = QuaStat
fields = '__all__'
read_only_fields = EXCLUDE_FIELDS + ['type', 'year', 'month', 'day']
read_only_fields = EXCLUDE_FIELDS + ['type', 'year', 'month', 'day', 'belong_dept']
def validate(self, attrs):
sflog = attrs['sflog']
attrs['type'] = 'sflog'
attrs['belong_dept'] = sflog.mgroup.belong_dept
return attrs