From b16dd1fe019b38d0dcdf4a400e9377fb06b33178 Mon Sep 17 00:00:00 2001 From: Loic Bistuer Date: Mon, 14 Oct 2013 22:42:33 +0700 Subject: Fixed #8620 -- Updated the Form metaclass to support excluding fields by shadowing them. --- django/forms/forms.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'django/forms/forms.py') 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 -- cgit v1.3