text: from rest_framework import serializers
  from users.models import User
  
  
  # POST
  class RegisterSerializer(serializers.ModelSerializer):
      class Meta:
          model = User
          fields = [
              'id', 'email', 'password', 'username'
          ]
      
      def create(self, validated_data):
          password = validated_data.pop('password', None)
          instance = self.Meta.model(validated_data)
          if password is not None:
              instance.set_password(password)
          instance.save()
          return instance
  
  
  # GET
  class UserSerializer(serializers.ModelSerializer):
      class Meta:
          model = User
          fields = [
              'id', 'email', 'username',
              'first_name', 'last_name',
          ]
  
  
  # PUT
  class UserUpdateSerializer(serializers.ModelSerializer):
      class Meta:
          model = User
          fields = [
              'first_name', 'last_name',
          ]
          
  