get_or_create does not pay attention to the instance calling it
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)
Description: |
modified (diff)
|
Triage Stage: |
Unreviewed → Design decision needed
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
Keywords: |
aug22sprint added
|
This was fixed in r8415.