summaryrefslogtreecommitdiff
path: root/django/db/models/base.py
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2010-01-05 04:30:51 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2010-01-05 04:30:51 +0000
commit1e81e2f5321d15a6689babe7f27f94bcee6aa4ac (patch)
tree4f80d4b8353b878107c6964dcf6ee2ca6bb33a1f /django/db/models/base.py
parent777da5bc732348d2182ad0231e89b0cad1a79b5b (diff)
Fixed another instance like [12099]. Thanks again, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12100 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/base.py')
-rw-r--r--django/db/models/base.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index af06ee1c12..06db7cc4e6 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -745,9 +745,7 @@ class Model(object):
if not getattr(self, '_adding', False) and self.pk is not None:
qs = qs.exclude(pk=self.pk)
- # This cute trick with extra/values is the most efficient way to
- # tell if a particular query returns any results.
- if qs.extra(select={'a': 1}).values('a').order_by():
+ if qs.exists():
errors.setdefault(field, []).append(
self.date_error_message(lookup_type, field, unique_for)
)