summaryrefslogtreecommitdiff
path: root/docs/ref/forms
diff options
context:
space:
mode:
Diffstat (limited to 'docs/ref/forms')
-rw-r--r--docs/ref/forms/api.txt18
1 files changed, 14 insertions, 4 deletions
diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt
index 950bd3a088..10e85b4019 100644
--- a/docs/ref/forms/api.txt
+++ b/docs/ref/forms/api.txt
@@ -982,10 +982,20 @@ classes::
.. versionadded:: 1.7
-* It's possible to opt-out from a ``Field`` inherited from a parent class by
- shadowing it. While any non-``Field`` value works for this purpose, it's
- recommended to use ``None`` to make it explicit that a field is being
- nullified.
+* It's possible to declaratively remove a ``Field`` inherited from a parent
+ class by setting the name to be ``None`` on the subclass. For example::
+
+ >>> from django import forms
+
+ >>> class ParentForm(forms.Form):
+ ... name = forms.CharField()
+ ... age = forms.IntegerField()
+
+ >>> class ChildForm(ParentForm):
+ ... name = None
+
+ >>> ChildForm().fields.keys()
+ ... ['age']
.. _form-prefix: