from users.models import UserP
from rest_framework import serializers
from django.contrib.auth.hashers import make_password


class UserSerializer(serializers.ModelSerializer):
    password = serializers.CharField(write_only=True, required=True,
        help_text='Leave empty if no change needed', style={'input_type':
        'password', 'placeholder': 'Password'})


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

    def create(self, validated_data):
        validated_data['password'] = make_password(validated_data.get(
            'password'))
        return super(UserSerializer, self).create(validated_data)

6ef979d21a788f06bf9a835a54e171fa2b84d225
<mask token>


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


    class Meta:
        model = UserP
        fields = '__all__'
        extra_kwargs = {'password': {'write_only': True}}
    <mask token>

<mask token>


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


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

    def create(self, validated_data):
        validated_data['password'] = make_password(validated_data.get(
            'password'))
        return super(UserSerializer, self).create(validated_data)

<mask token>


class UserSerializer(serializers.ModelSerializer):
    password = serializers.CharField(write_only=True, required=True,
        help_text='Leave empty if no change needed', style={'input_type':
        'password', 'placeholder': 'Password'})


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

    def create(self, validated_data):
        validated_data['password'] = make_password(validated_data.get(
            'password'))
        return super(UserSerializer, self).create(validated_data)

from users.models import UserP
from rest_framework import serializers
from django.contrib.auth.hashers import make_password


class UserSerializer(serializers.ModelSerializer):
    password = serializers.CharField(write_only=True, required=True,
        help_text='Leave empty if no change needed', style={'input_type':
        'password', 'placeholder': 'Password'})


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

    def create(self, validated_data):
        validated_data['password'] = make_password(validated_data.get(
            'password'))
        return super(UserSerializer, self).create(validated_data)
