mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
[soc2010/query-refactor] Provide a more useful error message on disjunctions.
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/query-refactor@13438 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a35cbdbeaf
commit
9c6e1c89c5
@ -25,6 +25,9 @@ class SQLCompiler(object):
|
|||||||
self.using = using
|
self.using = using
|
||||||
|
|
||||||
def get_filters(self, where):
|
def get_filters(self, where):
|
||||||
|
if where.connector != "AND":
|
||||||
|
raise UnsupportedDatabaseOperation("MongoDB only supports joining "
|
||||||
|
"filters with and, not or.")
|
||||||
assert where.connector == "AND"
|
assert where.connector == "AND"
|
||||||
filters = {}
|
filters = {}
|
||||||
for child in where.children:
|
for child in where.children:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from django.db import connection, UnsupportedDatabaseOperation
|
from django.db import connection, UnsupportedDatabaseOperation
|
||||||
from django.db.models import Count, Sum, F
|
from django.db.models import Count, Sum, F, Q
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from models import Artist, Group
|
from models import Artist, Group
|
||||||
@ -392,3 +392,7 @@ class MongoTestCase(TestCase):
|
|||||||
self.assert_unsupported(
|
self.assert_unsupported(
|
||||||
lambda: Artist.objects.aggregate(Count("id"), Count("pk"))
|
lambda: Artist.objects.aggregate(Count("id"), Count("pk"))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.assert_unsupported(
|
||||||
|
Artist.objects.filter(Q(pk=0) | Q(pk=1))
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user