I have a serializer like this:
class ContactSerializer(serializers.ModelSerializer):
class Meta:
model = Contact
fields = (
'account', 'first_name', 'last_name', 'email',
'phone_number',
)
validators = [
UniqueTogetherValidator(
queryset=Contact.objects.all(),
fields=['account', 'phone_number'],
message='A contact with this phone number is already exists.',
),
]
API returns the unique together validator errors as non_field_errors. I want to show it in the specific field. In this case phone_number.
How can I do that?