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

20 lines
491 B

# -*- coding: utf-8 -*-
#
from rest_framework import serializers
from ..models import User
__all__ = ['User2GroupRelationSerializer']
class User2GroupRelationSerializer(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'
]