1
0
mirror of https://github.com/django/django.git synced 2025-10-26 23:26:08 +00:00

Fixed #8620 -- Updated the Form metaclass to support excluding fields by shadowing them.

This commit is contained in:
Loic Bistuer
2013-10-14 22:42:33 +07:00
parent ac5ec7b8bc
commit b16dd1fe01
5 changed files with 52 additions and 0 deletions

View File

@@ -90,6 +90,11 @@ class DeclarativeFieldsMetaclass(MediaDefiningClass):
if hasattr(base, 'declared_fields'):
declared_fields.update(base.declared_fields)
# Field shadowing.
for attr in base.__dict__.keys():
if attr in declared_fields:
declared_fields.pop(attr)
new_class.base_fields = declared_fields
new_class.declared_fields = declared_fields