Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed a regression in validate_unique introduced in [12098]. Thanks, …

…Alex Gaynor.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12099 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 777da5bc732348d2182ad0231e89b0cad1a79b5b 1 parent 471596f
Joseph Kocherhans authored January 05, 2010

Showing 1 changed file with 1 addition and 3 deletions. Show diff stats Hide diff stats

  1. 4  django/db/models/base.py
4  django/db/models/base.py
@@ -715,9 +715,7 @@ def _perform_unique_checks(self, unique_checks):
715 715
             if not getattr(self, '_adding', False) and self.pk is not None:
716 716
                 qs = qs.exclude(pk=self.pk)
717 717
 
718  
-            # This cute trick with extra/values is the most efficient way to
719  
-            # tell if a particular query returns any results.
720  
-            if qs.extra(select={'a': 1}).values('a').order_by():
  718
+            if qs.exists():
721 719
                 if len(unique_check) == 1:
722 720
                     key = unique_check[0]
723 721
                 else:

0 notes on commit 777da5b

Please sign in to comment.
Something went wrong with that request. Please try again.