mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -715,9 +715,7 @@ class Model(object): | |||||||
|             if not getattr(self, '_adding', False) and self.pk is not None: |             if not getattr(self, '_adding', False) and self.pk is not None: | ||||||
|                 qs = qs.exclude(pk=self.pk) |                 qs = qs.exclude(pk=self.pk) | ||||||
|  |  | ||||||
|             # This cute trick with extra/values is the most efficient way to |             if qs.exists(): | ||||||
|             # tell if a particular query returns any results. |  | ||||||
|             if qs.extra(select={'a': 1}).values('a').order_by(): |  | ||||||
|                 if len(unique_check) == 1: |                 if len(unique_check) == 1: | ||||||
|                     key = unique_check[0] |                     key = unique_check[0] | ||||||
|                 else: |                 else: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user