Browse Source

fix: 系统用户认证方式从托管密码更新到手动输入模式后,不填写用户名报错

pull/6996/head
jiangweidong 3 years ago committed by xinwen
parent
commit
2f25e2b24c
  1. 8
      apps/common/mixins/serializers.py

8
apps/common/mixins/serializers.py

@ -297,10 +297,10 @@ class CommonSerializerMixin(DynamicFieldsMixin, DefaultValueFieldsMixin):
initial_data: dict
def get_initial_value(self, attr, default=None):
if self.instance:
return getattr(self.instance, attr, default)
else:
return self.initial_data.get(attr)
value = self.initial_data.get(attr)
if not value and self.instance:
value = getattr(self.instance, attr, default)
return value
class CommonBulkSerializerMixin(BulkSerializerMixin, CommonSerializerMixin):

Loading…
Cancel
Save