  
  
  class AnotherUniquenessModel(models.Model):
      code = models.IntegerField(unique=True)
  
  
  class AnotherUniquenessSerializer(serializers.ModelSerializer):
      class Meta:
 
</s> remove             validator = UniqueValidator(queryset=model_field.model._default_manager)
 </s> add             validator = UniqueValidator(
                queryset=model_field.model._default_manager,
                message=get_unique_error_message(model_field)) </s> remove             message=unique_error_message)
 </s> add             message=get_unique_error_message(model_field)) </s> remove         unique_error_message = model_field.error_messages.get('unique', None)
        if unique_error_message:
            unique_error_message = unique_error_message % {
                'model_name': model_field.model._meta.verbose_name,
                'field_label': model_field.verbose_name
            }
 </s> add 
class RelatedModelUserSerializer(serializers.ModelSerializer):
    class Meta:
        model = RelatedModel
        fields = ('user',)


  
  
class RelatedModelUserSerializer(serializers.ModelSerializer):
    class Meta:
        model = RelatedModel
        fields = ('user',)


  class AnotherUniquenessModel(models.Model):
      code = models.IntegerField(unique=True)
  
  
  class AnotherUniquenessSerializer(serializers.ModelSerializer):
      class Meta:
keep add keep keep keep keep keep keep
 Respect model error_messages for relation (#7599) 
tests/test_validators.py