summaryrefslogtreecommitdiff
path: root/docs/ref/forms
diff options
context:
space:
mode:
authorchillaranand <anand21nanda@gmail.com>2017-01-22 12:27:14 +0530
committerTim Graham <timograham@gmail.com>2017-01-25 11:53:05 -0500
commitdc165ec8e5698ffc6dee6b510f1f92c9fd7467fe (patch)
treeebcd5f708528b2aec195f9a97d28bd85653aa7dc /docs/ref/forms
parent2d96c027f5eb32c2c09bd57df2240ae1d343b98e (diff)
Refs #23919 -- Replaced super(ClassName, self) with super() in docs.
Diffstat (limited to 'docs/ref/forms')
-rw-r--r--docs/ref/forms/fields.txt4
-rw-r--r--docs/ref/forms/validation.txt18
-rw-r--r--docs/ref/forms/widgets.txt2
3 files changed, 12 insertions, 12 deletions
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt
index b135532b2d..2949ad0a9b 100644
--- a/docs/ref/forms/fields.txt
+++ b/docs/ref/forms/fields.txt
@@ -1029,7 +1029,7 @@ Slightly complex built-in ``Field`` classes
required=False,
),
)
- super(PhoneField, self).__init__(
+ super().__init__(
error_messages=error_messages, fields=fields,
require_all_fields=False, *args, **kwargs
)
@@ -1100,7 +1100,7 @@ method::
foo_select = forms.ModelMultipleChoiceField(queryset=None)
def __init__(self, *args, **kwargs):
- super(FooMultipleChoiceForm, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
self.fields['foo_select'].queryset = ...
``ModelChoiceField``
diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt
index b57f44cb6c..6d3edf93e3 100644
--- a/docs/ref/forms/validation.txt
+++ b/docs/ref/forms/validation.txt
@@ -272,7 +272,7 @@ containing comma-separated email addresses. The full class looks like this::
def validate(self, value):
"""Check if value consists only of valid emails."""
# Use the parent's handling of required fields, etc.
- super(MultiEmailField, self).validate(value)
+ super().validate(value)
for email in value:
validate_email(email)
@@ -352,7 +352,7 @@ example::
...
def clean(self):
- cleaned_data = super(ContactForm, self).clean()
+ cleaned_data = super().clean()
cc_myself = cleaned_data.get("cc_myself")
subject = cleaned_data.get("subject")
@@ -367,14 +367,14 @@ example::
In this code, if the validation error is raised, the form will display an
error message at the top of the form (normally) describing the problem.
-The call to ``super(ContactForm, self).clean()`` in the example code ensures
-that any validation logic in parent classes is maintained. If your form
-inherits another that doesn't return a ``cleaned_data`` dictionary in its
-``clean()`` method (doing so is optional), then don't assign ``cleaned_data``
-to the result of the ``super()`` call and use ``self.cleaned_data`` instead::
+The call to ``super().clean()`` in the example code ensures that any validation
+logic in parent classes is maintained. If your form inherits another that
+doesn't return a ``cleaned_data`` dictionary in its ``clean()`` method (doing
+so is optional), then don't assign ``cleaned_data`` to the result of the
+``super()`` call and use ``self.cleaned_data`` instead::
def clean(self):
- super(ContactForm, self).clean()
+ super().clean()
cc_myself = self.cleaned_data.get("cc_myself")
...
@@ -393,7 +393,7 @@ work out what works effectively in your particular situation. Our new code
...
def clean(self):
- cleaned_data = super(ContactForm, self).clean()
+ cleaned_data = super().clean()
cc_myself = cleaned_data.get("cc_myself")
subject = cleaned_data.get("subject")
diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt
index 210e5ce93c..9f3ea2840c 100644
--- a/docs/ref/forms/widgets.txt
+++ b/docs/ref/forms/widgets.txt
@@ -410,7 +410,7 @@ foundation for custom widgets.
widgets.Select(attrs=attrs, choices=months),
widgets.Select(attrs=attrs, choices=years),
)
- super(DateSelectorWidget, self).__init__(_widgets, attrs)
+ super().__init__(_widgets, attrs)
def decompress(self, value):
if value: