Cleaned up some small bits of the ORM, including removing an import *.
This commit is contained in:
parent
39aa8901e1
commit
0e296131bb
|
@ -4,7 +4,8 @@ from django.core.exceptions import FieldError
|
|||
from django.db import transaction
|
||||
from django.db.backends.util import truncate_name
|
||||
from django.db.models.query_utils import select_related_descend
|
||||
from django.db.models.sql.constants import *
|
||||
from django.db.models.sql.constants import (SINGLE, MULTI, ORDER_DIR,
|
||||
LOOKUP_SEP, GET_ITERATOR_CHUNK_SIZE)
|
||||
from django.db.models.sql.datastructures import EmptyResultSet
|
||||
from django.db.models.sql.expressions import SQLEvaluator
|
||||
from django.db.models.sql.query import get_order_dir, Query
|
||||
|
@ -811,7 +812,7 @@ class SQLCompiler(object):
|
|||
raise EmptyResultSet
|
||||
except EmptyResultSet:
|
||||
if result_type == MULTI:
|
||||
return empty_iter()
|
||||
return iter([])
|
||||
else:
|
||||
return
|
||||
|
||||
|
@ -1088,13 +1089,6 @@ class SQLDateCompiler(SQLCompiler):
|
|||
yield date
|
||||
|
||||
|
||||
def empty_iter():
|
||||
"""
|
||||
Returns an iterator containing no results.
|
||||
"""
|
||||
yield next(iter([]))
|
||||
|
||||
|
||||
def order_modified_iter(cursor, trim, sentinel):
|
||||
"""
|
||||
Yields blocks of rows from a cursor. We use this iterator in the special
|
||||
|
|
|
@ -17,9 +17,9 @@ from django.db import connections, DEFAULT_DB_ALIAS
|
|||
from django.db.models import signals
|
||||
from django.db.models.expressions import ExpressionNode
|
||||
from django.db.models.fields import FieldDoesNotExist
|
||||
from django.db.models.query_utils import InvalidQuery
|
||||
from django.db.models.sql import aggregates as base_aggregates_module
|
||||
from django.db.models.sql.constants import *
|
||||
from django.db.models.sql.constants import (QUERY_TERMS, LOOKUP_SEP, ORDER_DIR,
|
||||
SINGLE, ORDER_PATTERN, JoinInfo)
|
||||
from django.db.models.sql.datastructures import EmptyResultSet, Empty, MultiJoin
|
||||
from django.db.models.sql.expressions import SQLEvaluator
|
||||
from django.db.models.sql.where import (WhereNode, Constraint, EverythingNode,
|
||||
|
@ -28,6 +28,7 @@ from django.core.exceptions import FieldError
|
|||
|
||||
__all__ = ['Query', 'RawQuery']
|
||||
|
||||
|
||||
class RawQuery(object):
|
||||
"""
|
||||
A single raw SQL query
|
||||
|
|
|
@ -2,7 +2,7 @@ from __future__ import absolute_import
|
|||
|
||||
from datetime import date
|
||||
|
||||
from django.db.models.sql.query import InvalidQuery
|
||||
from django.db.models.query_utils import InvalidQuery
|
||||
from django.test import TestCase
|
||||
|
||||
from .models import Author, Book, Coffee, Reviewer, FriendlyAuthor
|
||||
|
|
Loading…
Reference in New Issue