#8459: get_or_create does not pay attention to the instance calling it
---------------------------------------------+------------------------------
Reporter: mymmaster | Owner: nobody
Status: new | Milestone: 1.0
Component: Database wrapper | Version: SVN
Resolution: | Keywords: get_or_create
Stage: Design decision needed | Has_patch: 0
Needs_docs: | Needs_tests:
Needs_better_patch: |
---------------------------------------------+------------------------------
Changes (by julianb):
* needs_better_patch: =>
* stage: Unreviewed => Design decision needed
* needs_tests: =>
* needs_docs: =>
Old description:
> get_or_create can be confusing to use because it doesn't pay attention to
> the object that is actually calling it. For example when calling
> {{{forumpost.participant_set.get_or_create(user=person)}}}
>
> it would make sense that get_or_create is referencing participant_set
> that is calling it and therefore would create a new entry to that result
> set if it doesn't exist. However, this is not the case. get_or_create
> merely uses participant_set to determine the type of object it is dealing
> with.
New description:
get_or_create can be confusing to use because it doesn't pay attention to
the object that is actually calling it. For example when calling
{{{forumpost.participant_set.get_or_create(user=person)}}}
it would make sense that get_or_create is referencing participant_set that
is calling it and therefore would create a new entry to that result set if
it doesn't exist. However, this is not the case. get_or_create merely uses
participant_set to determine the type of object it is dealing with.
--
Ticket URL: <http://code.djangoproject.com/ticket/8459#comment:>
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
-~----------~----~----~----~------~----~------~--~---