title: Django rest framework how to change: "This field may not be blank." error message
body: <p>When I am trying to create a new user model, I am getting the following validation error response:</p>
  <pre><code>HTTP 400 Bad Request
  Allow: POST, OPTIONS
  Content-Type: application/JSON
  Vary: Accept
  
  {
      &quot;phone&quot;: [
          &quot;This field may not be blank.&quot;
      ],
      &quot;name&quot;: [
          &quot;This field may not be blank.&quot;
      ]
  }
  </code></pre>
  <p>What I want to do is how to change the error message to a custom one.
  Here is my user serializer code:</p>
  <pre><code>from rest_framework import serializers
  from django.contrib.auth import get_user_model
  
  
  class UserSerializer(serializers.ModelSerializer):
      class Meta:
          model = get_user_model()
          fields = '__all__'
          read_only_fields = ('last_login',)
  </code></pre>
  <p>I already override the validate method but that didn't work neither using this solution:</p>
  <pre><code>extra_kwargs = {&quot;phone&quot;: {&quot;error_messages&quot;: {&quot;required&quot;: &quot;A valid phone number is required&quot;}}}
  </code></pre>
  <p>views.py:</p>
  <pre><code>class UserList(generics.CreateAPIView):
      queryset = User.objects.all()
      serializer_class = UserSerializer
  </code></pre>
  <p>(Custom user) User.py:</p>
  <pre><code>class User(AbstractBaseUser):
      &quot;&quot;&quot;
      Custom user model based on phone number as the only identifier
      &quot;&quot;&quot;
      phone = models.CharField(max_length=10, unique=True)
      name = models.CharField(max_length=50, blank=False)
      password = None
  
      USERNAME_FIELD = 'phone'
  
      objects = UserManager()
  
      def __str__(self):
          return self.name
  </code></pre>
  <p>User manager.py:</p>
  <pre><code>class UserManager(BaseUserManager):
      &quot;&quot;&quot;
      Custom user model manager where the phone is the unique identifier
      &quot;&quot;&quot;
  
      def create_user(self, phone, name, **extra_fields):
          &quot;&quot;&quot;
          Create and save a User using the given phone number and country
          &quot;&quot;&quot;
          if not phone:
              raise ValueError(_('A valid phone must be provided.'))
          if not name:
              raise ValueError(_('Your name is required'))
          user = self.model(phone=phone, name=name, **extra_fields)
          user.set_unusable_password()
          user.save(using=self._db)
  
      def create_superuser(self, phone, name, **extra_fields):
          &quot;&quot;&quot;
          Create and save a SuperUser with the given phone and country.
          &quot;&quot;&quot;
          extra_fields.setdefault('is_verified', True)
          extra_fields.setdefault('is_staff', True)
          extra_fields.setdefault('is_superuser', True)
  
          if extra_fields.get('is_staff') is not True:
              raise ValueError(_('Superuser must have is_staff=True.'))
          if extra_fields.get('is_superuser') is not True:
              raise ValueError(_('Superuser must have is_superuser=True.'))
          return self.create_user(phone, name, **extra_fields)
  </code></pre>
  <p>I know it's a silly problem but I couldn't solve it.
  Thanks for your appreciated help.</p>