summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2017-06-26 16:30:31 +0200
committerTim Graham <timograham@gmail.com>2017-06-26 10:30:31 -0400
commit081e78716085ff4af08604af5d084c8fd27c0730 (patch)
tree369d3c9617c9d28631b089d77fd53c9fed0fac18 /docs
parentfba0eaa5d60603721d7b4653e3efacbfb3613bd2 (diff)
Refs #23919 -- Stopped inheriting from object to define new style classes.
Tests and docs complement to cecc079168e8669138728d31611ff3a1e7eb3a9f.
Diffstat (limited to 'docs')
-rw-r--r--docs/howto/custom-model-fields.txt2
-rw-r--r--docs/howto/outputting-csv.txt2
-rw-r--r--docs/howto/writing-migrations.txt2
-rw-r--r--docs/internals/contributing/writing-code/coding-style.txt2
-rw-r--r--docs/intro/contributing.txt6
-rw-r--r--docs/topics/auth/customizing.txt8
-rw-r--r--docs/topics/auth/passwords.txt2
-rw-r--r--docs/topics/cache.txt2
-rw-r--r--docs/topics/class-based-views/generic-editing.txt2
-rw-r--r--docs/topics/class-based-views/mixins.txt2
-rw-r--r--docs/topics/db/multi-db.txt4
-rw-r--r--docs/topics/http/middleware.txt2
-rw-r--r--docs/topics/migrations.txt2
-rw-r--r--docs/topics/signals.txt2
-rw-r--r--docs/topics/templates.txt2
15 files changed, 21 insertions, 21 deletions
diff --git a/docs/howto/custom-model-fields.txt b/docs/howto/custom-model-fields.txt
index a64790b34c..d7ad9562a5 100644
--- a/docs/howto/custom-model-fields.txt
+++ b/docs/howto/custom-model-fields.txt
@@ -36,7 +36,7 @@ You only need to know that 52 cards are dealt out equally to four players, who
are traditionally called *north*, *east*, *south* and *west*. Our class looks
something like this::
- class Hand(object):
+ class Hand:
"""A hand of cards (bridge style)"""
def __init__(self, north, east, south, west):
diff --git a/docs/howto/outputting-csv.txt b/docs/howto/outputting-csv.txt
index 98824284ed..f6bc79c630 100644
--- a/docs/howto/outputting-csv.txt
+++ b/docs/howto/outputting-csv.txt
@@ -71,7 +71,7 @@ the assembly and transmission of a large CSV file::
from django.http import StreamingHttpResponse
- class Echo(object):
+ class Echo:
"""An object that implements just the write method of the file-like
interface.
"""
diff --git a/docs/howto/writing-migrations.txt b/docs/howto/writing-migrations.txt
index 55b30e9c98..8d5761485f 100644
--- a/docs/howto/writing-migrations.txt
+++ b/docs/howto/writing-migrations.txt
@@ -42,7 +42,7 @@ method of database routers as ``**hints``:
.. snippet::
:filename: myapp/dbrouters.py
- class MyRouter(object):
+ class MyRouter:
def allow_migrate(self, db, app_label, model_name=None, **hints):
if 'target_db' in hints:
diff --git a/docs/internals/contributing/writing-code/coding-style.txt b/docs/internals/contributing/writing-code/coding-style.txt
index 76b4918d09..1924e39e1d 100644
--- a/docs/internals/contributing/writing-code/coding-style.txt
+++ b/docs/internals/contributing/writing-code/coding-style.txt
@@ -151,7 +151,7 @@ Imports
CONSTANT = 'foo'
- class Example(object):
+ class Example:
# ...
* Use convenience imports whenever available. For example, do this::
diff --git a/docs/intro/contributing.txt b/docs/intro/contributing.txt
index 036d8880cf..764d166631 100644
--- a/docs/intro/contributing.txt
+++ b/docs/intro/contributing.txt
@@ -427,7 +427,7 @@ Navigate to the ``django/django/forms/`` folder and open the ``forms.py`` file.
Find the ``BaseForm`` class on line 72 and add the ``prefix`` class attribute
right after the ``field_order`` attribute::
- class BaseForm(object):
+ class BaseForm:
# This is the main implementation of all the Form logic. Note that this
# class is different than Form. See the comments by the Form class for
# more information. Any improvements to the form API should be made to
@@ -529,7 +529,7 @@ Use the arrow keys to move up and down.
index 509709f..d1370de 100644
--- a/django/forms/forms.py
+++ b/django/forms/forms.py
- @@ -75,6 +75,7 @@ class BaseForm(object):
+ @@ -75,6 +75,7 @@ class BaseForm:
# information. Any improvements to the form API should be made to *this*
# class, not to the Form class.
field_order = None
@@ -537,7 +537,7 @@ Use the arrow keys to move up and down.
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
initial=None, error_class=ErrorList, label_suffix=None,
- @@ -83,7 +84,8 @@ class BaseForm(object):
+ @@ -83,7 +84,8 @@ class BaseForm:
self.data = data or {}
self.files = files or {}
self.auto_id = auto_id
diff --git a/docs/topics/auth/customizing.txt b/docs/topics/auth/customizing.txt
index 22ab1d52fe..84f0782eb5 100644
--- a/docs/topics/auth/customizing.txt
+++ b/docs/topics/auth/customizing.txt
@@ -100,14 +100,14 @@ and returns a user object.
The ``authenticate`` method takes a ``request`` argument and credentials as
keyword arguments. Most of the time, it'll just look like this::
- class MyBackend(object):
+ class MyBackend:
def authenticate(self, request, username=None, password=None):
# Check the username/password and return a user.
...
But it could also authenticate a token, like so::
- class MyBackend(object):
+ class MyBackend:
def authenticate(self, request, token=None):
# Check the token and return a user.
...
@@ -135,7 +135,7 @@ object the first time a user authenticates::
from django.contrib.auth.hashers import check_password
from django.contrib.auth.models import User
- class SettingsBackend(object):
+ class SettingsBackend:
"""
Authenticate against the settings ADMIN_LOGIN and ADMIN_PASSWORD.
@@ -198,7 +198,7 @@ will immediately fail and Django won't check the backends that follow.
The simple backend above could implement permissions for the magic admin
fairly simply::
- class SettingsBackend(object):
+ class SettingsBackend:
...
def has_perm(self, user_obj, perm, obj=None):
return user_obj.username == settings.ADMIN_LOGIN
diff --git a/docs/topics/auth/passwords.txt b/docs/topics/auth/passwords.txt
index a786b568bc..6dcbe384a1 100644
--- a/docs/topics/auth/passwords.txt
+++ b/docs/topics/auth/passwords.txt
@@ -648,7 +648,7 @@ Here's a basic example of a validator, with one optional setting::
from django.core.exceptions import ValidationError
from django.utils.translation import gettext as _
- class MinimumLengthValidator(object):
+ class MinimumLengthValidator:
def __init__(self, min_length=8):
self.min_length = min_length
diff --git a/docs/topics/cache.txt b/docs/topics/cache.txt
index 42f178ee30..7d32f1f94f 100644
--- a/docs/topics/cache.txt
+++ b/docs/topics/cache.txt
@@ -238,7 +238,7 @@ operations to ``cache_replica``, and all write operations to
``cache_primary``. The cache table will only be synchronized onto
``cache_primary``::
- class CacheRouter(object):
+ class CacheRouter:
"""A router to control all database cache operations"""
def db_for_read(self, model, **hints):
diff --git a/docs/topics/class-based-views/generic-editing.txt b/docs/topics/class-based-views/generic-editing.txt
index 8643b71f8c..3fde51253a 100644
--- a/docs/topics/class-based-views/generic-editing.txt
+++ b/docs/topics/class-based-views/generic-editing.txt
@@ -233,7 +233,7 @@ works for AJAX requests as well as 'normal' form POSTs::
from django.views.generic.edit import CreateView
from myapp.models import Author
- class AjaxableResponseMixin(object):
+ class AjaxableResponseMixin:
"""
Mixin to add AJAX support to a form.
Must be used with an object-based FormView (e.g. CreateView)
diff --git a/docs/topics/class-based-views/mixins.txt b/docs/topics/class-based-views/mixins.txt
index 7165ab6a88..d0f0bddbc2 100644
--- a/docs/topics/class-based-views/mixins.txt
+++ b/docs/topics/class-based-views/mixins.txt
@@ -603,7 +603,7 @@ For example, a simple JSON mixin might look something like this::
from django.http import JsonResponse
- class JSONResponseMixin(object):
+ class JSONResponseMixin:
"""
A mixin that can be used to render a JSON response.
"""
diff --git a/docs/topics/db/multi-db.txt b/docs/topics/db/multi-db.txt
index d39277b69f..7617259b3d 100644
--- a/docs/topics/db/multi-db.txt
+++ b/docs/topics/db/multi-db.txt
@@ -295,7 +295,7 @@ databases::
Now we'll need to handle routing. First we want a router that knows to
send queries for the ``auth`` app to ``auth_db``::
- class AuthRouter(object):
+ class AuthRouter:
"""
A router to control all database operations on models in the
auth application.
@@ -340,7 +340,7 @@ from::
import random
- class PrimaryReplicaRouter(object):
+ class PrimaryReplicaRouter:
def db_for_read(self, model, **hints):
"""
Reads go to a randomly-chosen replica.
diff --git a/docs/topics/http/middleware.txt b/docs/topics/http/middleware.txt
index 09cf78557d..86283af7fa 100644
--- a/docs/topics/http/middleware.txt
+++ b/docs/topics/http/middleware.txt
@@ -43,7 +43,7 @@ A middleware can be written as a function that looks like this::
Or it can be written as a class whose instances are callable, like this::
- class SimpleMiddleware(object):
+ class SimpleMiddleware:
def __init__(self, get_response):
self.get_response = get_response
# One-time configuration and initialization.
diff --git a/docs/topics/migrations.txt b/docs/topics/migrations.txt
index edb4d84e98..a2eae4ff3d 100644
--- a/docs/topics/migrations.txt
+++ b/docs/topics/migrations.txt
@@ -717,7 +717,7 @@ serializable, you can use the ``@deconstructible`` class decorator from
from django.utils.deconstruct import deconstructible
@deconstructible
- class MyCustomClass(object):
+ class MyCustomClass:
def __init__(self, foo=1):
self.foo = foo
diff --git a/docs/topics/signals.txt b/docs/topics/signals.txt
index ad2b66f6df..80a92d7a9c 100644
--- a/docs/topics/signals.txt
+++ b/docs/topics/signals.txt
@@ -243,7 +243,7 @@ arguments as you like.
For example, here's how sending our ``pizza_done`` signal might look::
- class PizzaStore(object):
+ class PizzaStore:
...
def send_pizza(self, toppings, size):
diff --git a/docs/topics/templates.txt b/docs/topics/templates.txt
index e2930c85de..b461b97e7a 100644
--- a/docs/topics/templates.txt
+++ b/docs/topics/templates.txt
@@ -531,7 +531,7 @@ fictional ``foobar`` template library::
raise TemplateSyntaxError(exc.args)
- class Template(object):
+ class Template:
def __init__(self, template):
self.template = template