Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#8459 closed (fixed)

get_or_create does not pay attention to the instance calling it

Reported by: mymmaster Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords: get_or_create aug22sprint
Cc: farhan@… Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by Julian Bez)

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.

Change History (5)

comment:1 Changed 8 years ago by Julian Bez

Description: modified (diff)
Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 8 years ago by Farhan Ahmad

Cc: farhan@… added
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

comment:3 Changed 8 years ago by Charlie La Mothe

Resolution: fixed
Status: newclosed

This was fixed in r8415.

comment:4 Changed 8 years ago by Charlie La Mothe

Keywords: aug22sprint added

comment:5 Changed 5 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top