summaryrefslogtreecommitdiff
path: root/django/forms/forms.py
diff options
context:
space:
mode:
authorLoic Bistuer <loic.bistuer@sixmedia.com>2013-10-14 22:42:33 +0700
committerLoic Bistuer <loic.bistuer@sixmedia.com>2013-10-14 22:42:33 +0700
commitb16dd1fe019b38d0dcdf4a400e9377fb06b33178 (patch)
tree2c2a2da6a25b531bf7f3894938a77565a9a7250d /django/forms/forms.py
parentac5ec7b8bcc5623cc05d4df900c39e194f5affcf (diff)
Fixed #8620 -- Updated the Form metaclass to support excluding fields by shadowing them.
Diffstat (limited to 'django/forms/forms.py')
-rw-r--r--django/forms/forms.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/forms/forms.py b/django/forms/forms.py
index 8d0fa23daa..15c3e2c3f8 100644
--- a/django/forms/forms.py
+++ b/django/forms/forms.py
@@ -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