Only allow QNode instances to be passed as query objects

This commit is contained in:
Stefan Wojcik
2012-12-17 21:13:45 -08:00
parent ab4d4e6230
commit 148f8b8a3a
2 changed files with 11 additions and 0 deletions

View File

@@ -423,6 +423,9 @@ class QuerySet(object):
"""
query = Q(**query)
if q_obj:
# make sure proper query object is passed
if not isinstance(q_obj, QNode):
raise InvalidQueryError('Not a query object: %s. Did you intend to use key=value?' % q_obj)
query &= q_obj
self._query_obj &= query
self._mongo_query = None