  
  
  class TestUniquenessTogetherValidation(TestCase):
      def setUp(self):
          self.instance = UniquenessTogetherModel.objects.create(
              race_name='example',
              position=1
          )
 
</s> remove         UniquenessTogetherModel.objects.create(
            race_name=None,
 </s> add         # None values that are on fields which are part of the uniqueness
        # constraint cause the instance to ignore uniqueness validation.
        NullUniquenessTogetherModel.objects.create(
            date_of_birth=datetime.date(2000, 1, 1),
            race_name='Paris Marathon', </s> remove         data = {'race_name': None, 'position': None}
        serializer = UniquenessTogetherSerializer(data=data)

 </s> add         data = {
            'date': datetime.date(2000, 1, 1),
            'race_name': 'Paris Marathon',
            'position': None
        }
        serializer = NullUniquenessTogetherSerializer(data=data) </s> remove         if None not in attrs.values() and queryset.exists():
 </s> add         checked_values = [
            value for field, value in attrs.items() if field in self.fields
        ]
        if None not in checked_values and queryset.exists():
class NullUniquenessTogetherSerializer(serializers.ModelSerializer):
    class Meta:
        model = NullUniquenessTogetherModel


  
  
class NullUniquenessTogetherSerializer(serializers.ModelSerializer):
    class Meta:
        model = NullUniquenessTogetherModel


  class TestUniquenessTogetherValidation(TestCase):
      def setUp(self):
          self.instance = UniquenessTogetherModel.objects.create(
              race_name='example',
              position=1
          )
keep add keep keep keep keep keep keep
 Skip validation of NULL field only if it part of unique_together 
tests/test_validators.py