Checklist
Steps to reproduce
See test case in PR
Expected behavior
Serializer validates
Actual behavior
Serializer does not validate
I haven't dug into the internals too much, but it appears what happens is that when validating the unique_together constraint on a model where one of the fields has a default value that is not passed in as data to the serializer, the default value is substituted for the purposes of validation, even in the case where that field is available from an instance.
Checklist
masterbranch of Django REST framework.Steps to reproduce
See test case in PR
Expected behavior
Serializer validates
Actual behavior
Serializer does not validate
I haven't dug into the internals too much, but it appears what happens is that when validating the unique_together constraint on a model where one of the fields has a default value that is not passed in as data to the serializer, the default value is substituted for the purposes of validation, even in the case where that field is available from an instance.