summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorGary Wilson Jr <gary.wilson@gmail.com>2008-08-15 23:29:55 +0000
committerGary Wilson Jr <gary.wilson@gmail.com>2008-08-15 23:29:55 +0000
commitddc156bca2519dfb60974f49d085826d0a778f77 (patch)
treedc21b816ceff7718e8d283aea712d06fb09030ae /django
parent3b45a40c54993a36e2e56448326553e46a1b40d7 (diff)
Fixed #6970 -- Raise the original `IntegrityError` when all required fields aren't specified in `get_or_create` instead of a misleading `DoesNotExist` error, thanks deadwisdom.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8398 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/db/models/query.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py
index d82cdf4d96..1bc84c47ca 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -332,7 +332,10 @@ class QuerySet(object):
return obj, True
except IntegrityError, e:
transaction.savepoint_rollback(sid)
- return self.get(**kwargs), False
+ try:
+ return self.get(**kwargs), False
+ except self.model.DoesNotExist:
+ raise e
def latest(self, field_name=None):
"""