diff options
| author | Tom Christie | 2014-11-19 14:40:30 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-11-19 14:40:30 +0000 |
| commit | 851628107842a5bf84725247a42cae1ac90decf6 (patch) | |
| tree | d64d559da872a9fa114490667478bd7b9b95ba74 /rest_framework/serializers.py | |
| parent | 51b7033e4aeeefe19012a77b09a0b23d4a52a5bc (diff) | |
| download | django-rest-framework-851628107842a5bf84725247a42cae1ac90decf6.tar.bz2 | |
Minor fix for #2092.
Diffstat (limited to 'rest_framework/serializers.py')
| -rw-r--r-- | rest_framework/serializers.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 2e34dbe7..3189619e 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -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=...' |
