mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +03:00
Minor fix for #2092.
This commit is contained in:
parent
51b7033e4a
commit
8516281078
|
@ -736,12 +736,12 @@ class ModelSerializer(Serializer):
|
|||
])
|
||||
unique_constraint_names -= set([None])
|
||||
|
||||
# Include each of the `unique_together` field names,
|
||||
# so long as all the field names are included on the serializer.
|
||||
for parent_class in [model] + list(model._meta.parents.keys()):
|
||||
for unique_together_list in parent_class._meta.unique_together:
|
||||
if set(fields).issuperset(set(unique_together_list)):
|
||||
unique_constraint_names |= set(unique_together_list)
|
||||
# Include each of the `unique_together` field names,
|
||||
# so long as all the field names are included on the serializer.
|
||||
for parent_class in [model] + list(model._meta.parents.keys()):
|
||||
for unique_together_list in parent_class._meta.unique_together:
|
||||
if set(fields).issuperset(set(unique_together_list)):
|
||||
unique_constraint_names |= set(unique_together_list)
|
||||
|
||||
# Now we have all the field names that have uniqueness constraints
|
||||
# applied, we can add the extra 'required=...' or 'default=...'
|
||||
|
|
Loading…
Reference in New Issue
Block a user