0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Fixed gis_tests.geoapp when run in isolation.

"from django.db.models import *" in contrib/gis/db/models/__init__.py could
obscure gis's functions.py resulting in exceptions like:
"module 'django.db.models.functions' has no attribute 'Union'".
This commit is contained in:
Tim Graham 2016-10-10 10:13:01 -04:00 committed by GitHub
parent 19a140a1b3
commit 46a3d7604e
3 changed files with 39 additions and 14 deletions

View File

@ -1,8 +1,17 @@
from django.db.models import * # NOQA isort:skip
from django.db.models import __all__ as models_all # isort:skip
from django.contrib.gis.db.models.aggregates import * # NOQA
from django.contrib.gis.db.models.fields import ( # NOQA
from django.contrib.gis.db.models.aggregates import __all__ as aggregates_all
from django.contrib.gis.db.models.fields import (
GeometryCollectionField, GeometryField, LineStringField,
MultiLineStringField, MultiPointField, MultiPolygonField, PointField,
PolygonField, RasterField,
)
from django.contrib.gis.db.models.manager import GeoManager # NOQA
from django.contrib.gis.db.models.manager import GeoManager
__all__ = models_all + aggregates_all
__all__ += [
'GeometryCollectionField', 'GeometryField', 'LineStringField',
'MultiLineStringField', 'MultiPointField', 'MultiPolygonField', 'PointField',
'PolygonField', 'RasterField', 'GeoManager',
]

View File

@ -1,25 +1,28 @@
from django.core.exceptions import ObjectDoesNotExist # NOQA
from django.db.models import signals # NOQA
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import signals
from django.db.models.aggregates import * # NOQA
from django.db.models.deletion import ( # NOQA
from django.db.models.aggregates import __all__ as aggregates_all
from django.db.models.deletion import (
CASCADE, DO_NOTHING, PROTECT, SET, SET_DEFAULT, SET_NULL, ProtectedError,
)
from django.db.models.expressions import ( # NOQA
from django.db.models.expressions import (
Case, Expression, ExpressionWrapper, F, Func, Value, When,
)
from django.db.models.fields import * # NOQA
from django.db.models.fields.files import FileField, ImageField # NOQA
from django.db.models.fields.proxy import OrderWrt # NOQA
from django.db.models.fields import __all__ as fields_all
from django.db.models.fields.files import FileField, ImageField
from django.db.models.fields.proxy import OrderWrt
from django.db.models.indexes import * # 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
from django.db.models.indexes import __all__ as indexes_all
from django.db.models.lookups import Lookup, Transform
from django.db.models.manager import Manager
from django.db.models.query import (
Prefetch, Q, QuerySet, prefetch_related_objects,
)
# Imports that would create circular imports if sorted
from django.db.models.base import DEFERRED, Model # NOQA isort:skip
from django.db.models.fields.related import ( # NOQA isort:skip
from django.db.models.base import DEFERRED, Model # isort:skip
from django.db.models.fields.related import ( # isort:skip
ForeignKey, ForeignObject, OneToOneField, ManyToManyField,
ManyToOneRel, ManyToManyRel, OneToOneRel,
)
@ -52,3 +55,16 @@ def permalink(func):
bits = func(*args, **kwargs)
return reverse(bits[0], None, *bits[1:3])
return inner
__all__ = aggregates_all + fields_all + indexes_all
__all__ += [
'ObjectDoesNotExist', 'signals',
'CASCADE', 'DO_NOTHING', 'PROTECT', 'SET', 'SET_DEFAULT', 'SET_NULL',
'ProtectedError',
'Case', 'Expression', 'ExpressionWrapper', 'F', 'Func', 'Value', 'When',
'FileField', 'ImageField', 'OrderWrt', 'Lookup', 'Transform', 'Manager',
'Prefetch', 'Q', 'QuerySet', 'prefetch_related_objects', 'DEFERRED', 'Model',
'ForeignKey', 'ForeignObject', 'OneToOneField', 'ManyToManyField',
'ManyToOneRel', 'ManyToManyRel', 'OneToOneRel', 'permalink',
]

View File

@ -4,7 +4,7 @@ import hashlib
from django.utils.encoding import force_bytes
__all__ = ['Index']
__all__ = [str('Index')]
# The max length of the names of the indexes (restricted to 30 due to Oracle)
MAX_NAME_LENGTH = 30