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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user