summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/models/sql/query.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 907903dc90..e921687c99 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -988,7 +988,10 @@ class Query(object):
try:
sql, params = self.as_sql()
except EmptyResultSet:
- raise StopIteration
+ if result_type == MULTI:
+ raise StopIteration
+ else:
+ return
cursor = self.connection.cursor()
cursor.execute(sql, params)