mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 05:20:12 +03:00
Check that declared base field is not in attrs
This commit is contained in:
parent
a41a1e466d
commit
79e2c9209c
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user