mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-29 13:04:03 +03:00
Unique together checks should apply to fields that are read only, but have a default. (#4316)
This commit is contained in:
parent
1acbc29d58
commit
6a7d34ec34
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user