summaryrefslogtreecommitdiff
path: root/docs/howto
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/howto
parent2d96c027f5eb32c2c09bd57df2240ae1d343b98e (diff)
Refs #23919 -- Replaced super(ClassName, self) with super() in docs.
Diffstat (limited to 'docs/howto')
-rw-r--r--docs/howto/custom-lookups.txt2
-rw-r--r--docs/howto/custom-management-commands.txt2
-rw-r--r--docs/howto/custom-model-fields.txt16
3 files changed, 10 insertions, 10 deletions
diff --git a/docs/howto/custom-lookups.txt b/docs/howto/custom-lookups.txt
index 0b1cd717b9..64f7e5aca4 100644
--- a/docs/howto/custom-lookups.txt
+++ b/docs/howto/custom-lookups.txt
@@ -294,7 +294,7 @@ would override ``get_lookup`` with something like::
pass
else:
return get_coordinate_lookup(dimension)
- return super(CoordinatesField, self).get_lookup(lookup_name)
+ return super().get_lookup(lookup_name)
You would then define ``get_coordinate_lookup`` appropriately to return a
``Lookup`` subclass which handles the relevant value of ``dimension``.
diff --git a/docs/howto/custom-management-commands.txt b/docs/howto/custom-management-commands.txt
index 51db07e540..b5212e305c 100644
--- a/docs/howto/custom-management-commands.txt
+++ b/docs/howto/custom-management-commands.txt
@@ -274,7 +274,7 @@ the :meth:`~BaseCommand.handle` method must be implemented.
class Command(BaseCommand):
def __init__(self, *args, **kwargs):
- super(Command, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
# ...
.. method:: BaseCommand.add_arguments(parser)
diff --git a/docs/howto/custom-model-fields.txt b/docs/howto/custom-model-fields.txt
index 09d00e0928..500cf58eaa 100644
--- a/docs/howto/custom-model-fields.txt
+++ b/docs/howto/custom-model-fields.txt
@@ -168,7 +168,7 @@ behave like any existing field, so we'll subclass directly from
def __init__(self, *args, **kwargs):
kwargs['max_length'] = 104
- super(HandField, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
Our ``HandField`` accepts most of the standard field options (see the list
below), but we ensure it has a fixed length, since it only needs to hold 52
@@ -262,10 +262,10 @@ we can drop it from the keyword arguments for readability::
def __init__(self, *args, **kwargs):
kwargs['max_length'] = 104
- super(HandField, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def deconstruct(self):
- name, path, args, kwargs = super(HandField, self).deconstruct()
+ name, path, args, kwargs = super().deconstruct()
del kwargs["max_length"]
return name, path, args, kwargs
@@ -279,10 +279,10 @@ into ``kwargs`` yourself::
def __init__(self, separator=",", *args, **kwargs):
self.separator = separator
- super(CommaSepField, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def deconstruct(self):
- name, path, args, kwargs = super(CommaSepField, self).deconstruct()
+ name, path, args, kwargs = super().deconstruct()
# Only include kwarg if it's not the default
if self.separator != ",":
kwargs['separator'] = self.separator
@@ -435,7 +435,7 @@ time -- i.e., when the class is instantiated. To do that, just implement
class BetterCharField(models.Field):
def __init__(self, max_length, *args, **kwargs):
self.max_length = max_length
- super(BetterCharField, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def db_type(self, connection):
return 'char(%s)' % self.max_length
@@ -576,7 +576,7 @@ For example, Django uses the following method for its
:class:`BinaryField`::
def get_db_prep_value(self, value, connection, prepared=False):
- value = super(BinaryField, self).get_db_prep_value(value, connection, prepared)
+ value = super().get_db_prep_value(value, connection, prepared)
if value is not None:
return connection.Database.Binary(value)
return value
@@ -633,7 +633,7 @@ as::
# while letting the caller override them.
defaults = {'form_class': MyFormField}
defaults.update(kwargs)
- return super(HandField, self).formfield(**defaults)
+ return super().formfield(**defaults)
This assumes we've imported a ``MyFormField`` field class (which has its own
default widget). This document doesn't cover the details of writing custom form