Skip to content

Commit 8c31636

Browse files
auvipypauloxnet
andauthored
Update rest_framework/serializers.py
Co-authored-by: Paolo Melchiorre <[email protected]>
1 parent 3fd9ab5 commit 8c31636

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

rest_framework/serializers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,8 +1473,9 @@ def get_uniqueness_extra_kwargs(self, field_names, declared_fields, extra_kwargs
14731473
# Include each of the `unique_together` and `UniqueConstraint` field names,
14741474
# so long as all the field names are included on the serializer.
14751475
for unique_together_list, queryset, condition_fields, condition in self.get_unique_together_constraints(model):
1476-
if set(field_names).issuperset((*unique_together_list, *condition_fields)):
1477-
unique_constraint_names |= set((*unique_together_list, *condition_fields))
1476+
unique_together_list_and_condition_fields = (*unique_together_list, *condition_fields)
1477+
if set(field_names).issuperset(unique_together_list_and_condition_fields):
1478+
unique_constraint_names |= set(unique_together_list_and_condition_fields)
14781479

14791480
# Now we have all the field names that have uniqueness constraints
14801481
# applied, we can add the extra 'required=...' or 'default=...'

0 commit comments

Comments
 (0)