Check that declared base field is not in attrs

This commit is contained in:
Ryan P Kilby 2016-12-23 14:52:57 -05:00
parent a41a1e466d
commit 79e2c9209c

View File

@ -305,7 +305,11 @@ class SerializerMetaclass(type):
# in order to maintain the correct order of fields. # in order to maintain the correct order of fields.
for base in reversed(bases): for base in reversed(bases):
if hasattr(base, '_declared_fields'): if hasattr(base, '_declared_fields'):
fields = list(base._declared_fields.items()) + fields fields = [
(field_name, obj) for field_name, obj
in base._declared_fields.items()
if field_name not in attrs
] + fields
return OrderedDict(fields) return OrderedDict(fields)