Browse Source

[Update] orgs.serializers.OrgReadSerializer add `id`

pull/4025/head
xinwen 5 years ago
parent
commit
7b0993959e
  1. 7
      apps/orgs/serializers.py
  2. 2
      apps/users/serializers/user.py

7
apps/orgs/serializers.py

@ -6,6 +6,7 @@ from users.models import User, UserGroup
from assets.models import Asset, Domain, AdminUser, SystemUser, Label
from perms.models import AssetPermission
from common.serializers import AdaptedBulkListSerializer
from users.serializers import UserOrgSerializer
from .utils import set_current_org, get_current_org
from .models import Organization
from .mixins.serializers import OrgMembershipSerializerMixin
@ -20,9 +21,9 @@ class OrgSerializer(ModelSerializer):
class OrgReadSerializer(ModelSerializer):
admins = serializers.SlugRelatedField(slug_field='name', many=True, read_only=True)
auditors = serializers.SlugRelatedField(slug_field='name', many=True, read_only=True)
users = serializers.SlugRelatedField(slug_field='name', many=True, read_only=True)
admins = UserOrgSerializer(many=True, read_only=True)
auditors = UserOrgSerializer(many=True, read_only=True)
users = UserOrgSerializer(many=True, read_only=True)
user_groups = serializers.SerializerMethodField()
assets = serializers.SerializerMethodField()
domains = serializers.SerializerMethodField()

2
apps/users/serializers/user.py

@ -14,7 +14,7 @@ from ..models import User
__all__ = [
'UserSerializer', 'UserPKUpdateSerializer',
'ChangeUserPasswordSerializer', 'ResetOTPSerializer',
'UserProfileSerializer',
'UserProfileSerializer', 'UserOrgSerializer'
]

Loading…
Cancel
Save