Answers for "drf serializer unique together"

0

drf serializer unique together

class SomeSerializer(serializers.ModelSerializer):
    class Meta:
        model = Some
        fields = ('field1', 'field2')
        validators = [
            serializers.UniqueTogetherValidator(
                queryset=model.objects.all(),
                fields=('field1', 'field2'),
                message='Some custom message.'
            )
        ]
Posted by: Guest on October-03-2021

Python Answers by Framework

Browse Popular Code Answers by Language