diff --git a/django/db/models/__init__.py b/django/db/models/__init__.py index 8deb9cfaa8..354985297e 100644 --- a/django/db/models/__init__.py +++ b/django/db/models/__init__.py @@ -7,7 +7,7 @@ from django.db.models.deletion import ( # NOQA CASCADE, DO_NOTHING, PROTECT, SET, SET_DEFAULT, SET_NULL, ProtectedError, ) from django.db.models.expressions import ( # NOQA - F, Case, Expression, ExpressionWrapper, Func, Value, When, + Case, Expression, ExpressionWrapper, F, Func, Value, When, ) from django.db.models.fields import * # NOQA from django.db.models.fields.files import FileField, ImageField # NOQA @@ -15,7 +15,7 @@ from django.db.models.fields.proxy import OrderWrt # NOQA from django.db.models.lookups import Lookup, Transform # NOQA from django.db.models.manager import Manager # NOQA from django.db.models.query import ( # NOQA - Q, Prefetch, QuerySet, prefetch_related_objects, + Prefetch, Q, QuerySet, prefetch_related_objects, ) # Imports that would create circular imports if sorted diff --git a/django/db/models/query.py b/django/db/models/query.py index b70be466f9..cb9e7a9ce7 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -16,10 +16,10 @@ from django.db import ( from django.db.models import sql from django.db.models.constants import LOOKUP_SEP from django.db.models.deletion import Collector -from django.db.models.expressions import F, Date, DateTime +from django.db.models.expressions import Date, DateTime, F from django.db.models.fields import AutoField from django.db.models.query_utils import ( - Q, InvalidQuery, check_rel_lookup_compatibility, deferred_class_factory, + InvalidQuery, Q, check_rel_lookup_compatibility, deferred_class_factory, ) from django.db.models.sql.constants import CURSOR from django.utils import six, timezone diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 2f98ab895a..1223e9a109 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -19,7 +19,7 @@ from django.db.models.constants import LOOKUP_SEP from django.db.models.expressions import Col, Ref from django.db.models.fields.related_lookups import MultiColSource from django.db.models.query_utils import ( - Q, PathInfo, check_rel_lookup_compatibility, refs_expression, + PathInfo, Q, check_rel_lookup_compatibility, refs_expression, ) from django.db.models.sql.constants import ( INNER, LOUTER, ORDER_DIR, ORDER_PATTERN, QUERY_TERMS, SINGLE, diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index f6054a1b73..2e68d0a7f3 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -7,7 +7,7 @@ from decimal import Decimal from django.core.exceptions import FieldError from django.db import connection from django.db.models import ( - F, Avg, Count, DecimalField, DurationField, FloatField, Func, IntegerField, + Avg, Count, DecimalField, DurationField, F, FloatField, Func, IntegerField, Max, Min, Sum, Value, ) from django.test import TestCase diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py index c207776822..f92459a990 100644 --- a/tests/aggregation_regress/tests.py +++ b/tests/aggregation_regress/tests.py @@ -9,7 +9,7 @@ from django.contrib.contenttypes.models import ContentType from django.core.exceptions import FieldError from django.db import connection from django.db.models import ( - F, Q, Avg, Count, Max, StdDev, Sum, Value, Variance, + Avg, Count, F, Max, Q, StdDev, Sum, Value, Variance, ) from django.test import TestCase, skipUnlessAnyDBFeature, skipUnlessDBFeature from django.test.utils import Approximate diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py index c001b4e7f2..d57f9ed0d7 100644 --- a/tests/annotations/tests.py +++ b/tests/annotations/tests.py @@ -5,7 +5,7 @@ from decimal import Decimal from django.core.exceptions import FieldDoesNotExist, FieldError from django.db.models import ( - F, BooleanField, CharField, Count, DateTimeField, ExpressionWrapper, Func, + BooleanField, CharField, Count, DateTimeField, ExpressionWrapper, F, Func, IntegerField, Sum, Value, ) from django.db.models.functions import Lower diff --git a/tests/delete/tests.py b/tests/delete/tests.py index 5b38dc0cd6..9bb179cb3f 100644 --- a/tests/delete/tests.py +++ b/tests/delete/tests.py @@ -8,8 +8,8 @@ from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from django.utils.six.moves import range from .models import ( - A, M, MR, R, S, T, Avatar, Base, Child, HiddenUser, HiddenUserProfile, - M2MFrom, M2MTo, MRNull, Parent, RChild, User, create_a, get_default_r, + MR, A, Avatar, Base, Child, HiddenUser, HiddenUserProfile, M, M2MFrom, + M2MTo, MRNull, Parent, R, RChild, S, T, User, create_a, get_default_r, ) diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py index 7a4f4adbc7..df02463af7 100644 --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -11,7 +11,7 @@ from django.db.models.aggregates import ( Avg, Count, Max, Min, StdDev, Sum, Variance, ) from django.db.models.expressions import ( - F, Case, Col, Date, DateTime, ExpressionWrapper, Func, OrderBy, Random, + Case, Col, Date, DateTime, ExpressionWrapper, F, Func, OrderBy, Random, RawSQL, Ref, Value, When, ) from django.db.models.functions import ( diff --git a/tests/expressions_case/tests.py b/tests/expressions_case/tests.py index f9cdfc5d5c..30e8a704ae 100644 --- a/tests/expressions_case/tests.py +++ b/tests/expressions_case/tests.py @@ -8,7 +8,7 @@ from uuid import UUID from django.core.exceptions import FieldError from django.db import connection, models -from django.db.models import F, Q, Max, Min, Sum, Value +from django.db.models import F, Max, Min, Q, Sum, Value from django.db.models.expressions import Case, When from django.test import TestCase from django.utils import six diff --git a/tests/generic_relations_regress/tests.py b/tests/generic_relations_regress/tests.py index 957f285b23..0a5758d0fc 100644 --- a/tests/generic_relations_regress/tests.py +++ b/tests/generic_relations_regress/tests.py @@ -5,7 +5,7 @@ from django.forms.models import modelform_factory from django.test import TestCase, skipIfDBFeature from .models import ( - A, B, C, D, Address, Board, CharLink, Company, Contact, Content, Developer, + A, Address, B, Board, C, CharLink, Company, Contact, Content, D, Developer, Guild, HasLinkThing, Link, Node, Note, OddRelation1, OddRelation2, Organization, Person, Place, Related, Restaurant, Tag, Team, TextLink, ) diff --git a/tests/gis_tests/relatedapp/tests.py b/tests/gis_tests/relatedapp/tests.py index 5fc693f3cf..66507313e8 100644 --- a/tests/gis_tests/relatedapp/tests.py +++ b/tests/gis_tests/relatedapp/tests.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals -from django.contrib.gis.db.models import F, Collect, Count, Extent, Union +from django.contrib.gis.db.models import Collect, Count, Extent, F, Union from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.geos import GEOSGeometry, MultiPoint, Point from django.db import connection diff --git a/tests/gis_tests/test_measure.py b/tests/gis_tests/test_measure.py index 06d35c0371..174b04a29c 100644 --- a/tests/gis_tests/test_measure.py +++ b/tests/gis_tests/test_measure.py @@ -5,7 +5,7 @@ and conversions. Here are some tests. import unittest -from django.contrib.gis.measure import A, D, Area, Distance +from django.contrib.gis.measure import A, Area, D, Distance class DistanceTest(unittest.TestCase): diff --git a/tests/queries/tests.py b/tests/queries/tests.py index a34758d7dd..3a36316407 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -8,7 +8,7 @@ from operator import attrgetter from django.core.exceptions import FieldError from django.db import DEFAULT_DB_ALIAS, connection -from django.db.models import F, Q, Count +from django.db.models import Count, F, Q from django.db.models.sql.constants import LOUTER from django.db.models.sql.datastructures import EmptyResultSet from django.db.models.sql.where import NothingNode, WhereNode @@ -18,7 +18,7 @@ from django.utils import six from django.utils.six.moves import range from .models import ( - FK1, X, Annotation, Article, Author, BaseA, Book, CategoryItem, + FK1, Annotation, Article, Author, BaseA, Book, CategoryItem, CategoryRelationship, Celebrity, Channel, Chapter, Child, ChildObjectA, Classroom, Company, Cover, CustomPk, CustomPkTag, Detail, DumbCategory, Eaten, Employment, ExtraInfo, Fan, Food, Identifier, Individual, Item, Job, @@ -30,7 +30,7 @@ from .models import ( RelatedIndividual, RelatedObject, Report, ReservedName, Responsibility, School, SharedConnection, SimpleCategory, SingleObject, SpecialCategory, Staff, StaffUser, Student, Tag, Task, Ticket21203Child, Ticket21203Parent, - Ticket23605A, Ticket23605B, Ticket23605C, TvChef, Valid, + Ticket23605A, Ticket23605B, Ticket23605C, TvChef, Valid, X, ) diff --git a/tests/select_related_regress/tests.py b/tests/select_related_regress/tests.py index e575697cb1..640add4638 100644 --- a/tests/select_related_regress/tests.py +++ b/tests/select_related_regress/tests.py @@ -4,7 +4,7 @@ from django.test import TestCase from django.utils import six from .models import ( - A, B, C, Building, Chick, Child, Class, Client, ClientStatus, Connection, + A, B, Building, C, Chick, Child, Class, Client, ClientStatus, Connection, Country, Device, Enrollment, Hen, Item, Organizer, Person, Port, SpecialClient, State, Student, TUser, ) diff --git a/tests/update/tests.py b/tests/update/tests.py index 0a4e1fb3ba..4379809c08 100644 --- a/tests/update/tests.py +++ b/tests/update/tests.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.test import TestCase -from .models import A, B, D, Bar, DataPoint, Foo, RelatedPoint +from .models import A, B, Bar, D, DataPoint, Foo, RelatedPoint class SimpleTest(TestCase):