Alphabetized imports in various docs.

Follow-up of d97cce3409 and 7d3fe36c62.
This commit is contained in:
Mariusz Felisiak 2018-05-12 19:37:42 +02:00 committed by GitHub
parent 1b7d524cfa
commit 35319bf12c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 71 additions and 71 deletions

View file

@ -48,7 +48,7 @@ keyword.
Some examples::
>>> from django.db.models import When, F, Q
>>> from django.db.models import F, Q, When
>>> # String arguments refer to fields; the following two examples are equivalent:
>>> When(account_type=Client.GOLD, then='name')
>>> When(account_type=Client.GOLD, then=F('name'))
@ -88,7 +88,7 @@ A simple example::
>>>
>>> from datetime import date, timedelta
>>> from django.db.models import CharField, Case, Value, When
>>> from django.db.models import Case, CharField, Value, When
>>> Client.objects.create(
... name='Jane Doe',
... account_type=Client.REGULAR,

View file

@ -979,7 +979,7 @@ than 0. If ``length`` is ``None``, then the rest of the string will be returned.
Usage example::
>>> # Set the alias to the first 5 characters of the name as lowercase
>>> from django.db.models.functions import Substr, Lower
>>> from django.db.models.functions import Lower, Substr
>>> Author.objects.create(name='Margaret Smith')
>>> Author.objects.update(alias=Lower(Substr('name', 1, 5)))
1

View file

@ -26,7 +26,7 @@ Some examples
.. code-block:: python
from django.db.models import F, Count, Value
from django.db.models import Count, F, Value
from django.db.models.functions import Length, Upper
# Find companies that have more employees than chairs.
@ -252,7 +252,7 @@ is null) after companies that have been contacted::
database functions like ``COALESCE`` and ``LOWER``, or aggregates like ``SUM``.
They can be used directly::
from django.db.models import Func, F
from django.db.models import F, Func
queryset.annotate(field_lower=Func(F('field'), function='LOWER'))

View file

@ -277,7 +277,7 @@ will be stored in a special error dictionary key,
:data:`~django.core.exceptions.NON_FIELD_ERRORS`. This key is used for errors
that are tied to the entire model instead of to a specific field::
from django.core.exceptions import ValidationError, NON_FIELD_ERRORS
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
try:
article.full_clean()
except ValidationError as e: