You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jumpserver/apps/users/serializers/realtion.py

19 lines
485 B

# -*- coding: utf-8 -*-
#
from rest_framework import serializers
from ..models import User
__all__ = ['UserUserGroupRelationSerializer']
class UserUserGroupRelationSerializer(serializers.ModelSerializer):
user_display = serializers.CharField(read_only=True)
usergroup_display = serializers.CharField(read_only=True)
class Meta:
model = User.groups.through
fields = [
'id', 'user', 'user_display', 'usergroup', 'usergroup_display'
]