From ddc156bca2519dfb60974f49d085826d0a778f77 Mon Sep 17 00:00:00 2001 From: Gary Wilson Jr Date: Fri, 15 Aug 2008 23:29:55 +0000 Subject: 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 --- tests/modeltests/get_or_create/models.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/modeltests/get_or_create/models.py b/tests/modeltests/get_or_create/models.py index 3a1b447c97..5c35bb4bec 100644 --- a/tests/modeltests/get_or_create/models.py +++ b/tests/modeltests/get_or_create/models.py @@ -50,4 +50,11 @@ True False >>> Person.objects.count() 2 + +# If you don't specify a value or default value for all required fields, you +# will get an error. +>>> p, created = Person.objects.get_or_create(first_name='Tom', last_name='Smith') +Traceback (most recent call last): +... +IntegrityError:... """} -- cgit v1.3