Opened 17 years ago
Last modified 17 years ago
#4660 closed
get_or_create has unpredictable behavior with _id fields — at Version 2
Reported by: | oggie rob | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | ||
Cc: | oz.robharvey@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
You can use relfield_id
(one underscore) as an argument to create an object, and relfield__id
(two underscores) as an argument to filter for an object. Unfortunately, with get_or_create
, you don't know which one you will need. This means you can't safely specify the id field directly, and have to look up objects in order to use get_or_create.
Note:
See TracTickets
for help on using tickets.
That should read: