Commit 6a7d34ec by Tom Christie Committed by GitHub

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

parent 1acbc29d
...@@ -1396,9 +1396,8 @@ class ModelSerializer(Serializer): ...@@ -1396,9 +1396,8 @@ class ModelSerializer(Serializer):
# cannot map to a field, and must be a traversal, so we're not # cannot map to a field, and must be a traversal, so we're not
# including those. # including those.
field_names = { 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) 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 # Note that we make sure to check `unique_together` both on the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment