Unique together checks should apply to fields that are read only, but have a default.

This commit is contained in:
Tom Christie 2016-07-27 15:15:53 +01:00
parent 3586c8a61a
commit 960747d425

View File

@ -1396,9 +1396,8 @@ class ModelSerializer(Serializer):
# cannot map to a field, and must be a traversal, so we're not
# including those.
field_names = {
field.source for field in self.fields.values()
field.source for field in self._writable_fields
if (field.source != '*') and ('.' not in field.source)
and not field.read_only
}
# Note that we make sure to check `unique_together` both on the