from django.contrib.auth import get_user_model
from rest_framework import serializers
User = get_user_model()


class UserSerializer(serializers.ModelSerializer):
    role_display = serializers.SerializerMethodField()

    def get_role_display(self, obj):
        return obj.get_role_display()


    class Meta:
        model = User
        fields = '__all__'
        extra_kwargs = {'password': {'write_only': True}}

0dd6db0f1b14436a7591c8f250f5a3a96ec73c80
<mask token>


class UserSerializer(serializers.ModelSerializer):
    <mask token>

    def get_role_display(self, obj):
        return obj.get_role_display()


    class Meta:
        model = User
        fields = '__all__'
        extra_kwargs = {'password': {'write_only': True}}

<mask token>


class UserSerializer(serializers.ModelSerializer):
    role_display = serializers.SerializerMethodField()

    def get_role_display(self, obj):
        return obj.get_role_display()


    class Meta:
        model = User
        fields = '__all__'
        extra_kwargs = {'password': {'write_only': True}}

<mask token>
User = get_user_model()


class UserSerializer(serializers.ModelSerializer):
    role_display = serializers.SerializerMethodField()

    def get_role_display(self, obj):
        return obj.get_role_display()


    class Meta:
        model = User
        fields = '__all__'
        extra_kwargs = {'password': {'write_only': True}}

from django.contrib.auth import get_user_model
from rest_framework import serializers
User = get_user_model()


class UserSerializer(serializers.ModelSerializer):
    role_display = serializers.SerializerMethodField()

    def get_role_display(self, obj):
        return obj.get_role_display()


    class Meta:
        model = User
        fields = '__all__'
        extra_kwargs = {'password': {'write_only': True}}
