[Update] 修改profile serialzier

pull/4019/head
ibuler 2020-05-12 17:57:35 +08:00
parent dd5bf546df
commit 195cbbbe42
1 changed files with 13 additions and 10 deletions

View File

@ -181,16 +181,19 @@ class ResetOTPSerializer(serializers.Serializer):
pass
class UserProfileSerializer(serializers.ModelSerializer):
class UserProfileSerializer(UserSerializer):
admin_or_audit_orgs = UserOrgSerializer(many=True, read_only=True)
class Meta:
model = User
fields = [
'id', 'name', 'username', 'email',
'role', 'wechat', 'phone', 'mfa_level',
'comment', 'source', 'is_valid', 'is_expired',
'is_active', 'created_by', 'is_first_login',
'date_password_last_updated', 'date_expired',
'avatar_url', 'groups', 'admin_or_audit_orgs',
class Meta(UserSerializer.Meta):
# fields = [
# 'id', 'name', 'username', 'email',
# 'role', 'wechat', 'phone', 'mfa_level',
# 'comment', 'source', 'is_valid', 'is_expired',
# 'is_active', 'created_by', 'is_first_login',
# 'date_password_last_updated', 'date_expired',
# 'avatar_url', 'groups', 'admin_or_audit_orgs',
# ]
fields = UserSerializer.Meta.fields + [
'admin_or_audit_orgs'
]