#7789: get_or_create fails due to case sensivity
----------------------------------------+-----------------------------------
Reporter: Julian Bez | Owner: nobody
Status: new | Milestone:
Component: Database wrapper | Version: SVN
Keywords: get_or_create iexact exact | Stage: Unreviewed
Has_patch: 0 |
----------------------------------------+-----------------------------------
{{{
>>> name, created = Name.objects.get_or_create(name="Julian")
>>> created
True
>>> name, created = Name.objects.get_or_create(name="julian")
Traceback (most recent call last):
File "<console>", line 1, in ?
File "/usr/lib/python2.4/site-packages/django/db/models/manager.py",
line 85, in get_or_create
return self.get_query_set().get_or_create(**kwargs)
File "/usr/lib/python2.4/site-packages/django/db/models/query.py", line
335, in get_or_create
return self.get(**kwargs), False
File "/usr/lib/python2.4/site-packages/django/db/models/query.py", line
302, in get
raise self.model.DoesNotExist("%s matching query does not exist."
DoesNotExist: Name matching query does not exist.
>>> name, created = Name.objects.get_or_create(name__iexact="julian")
>>> created
False
}}}
In my opinion get_or_create should get the name if it is there, or create
a new one, not fail.
May be related to [7798].
--
Ticket URL: <http://code.djangoproject.com/ticket/7789>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---