Opened 12 years ago
Closed 12 years ago
#19089 closed Bug (duplicate)
Incorrect reverse one-to-one lookup on unsaved objects
Reported by: | Aymeric Augustin | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Let's assume two models, A
and B
. A
has a nullable one-to-one relation to B
.
Let's create a single instance of A
in the database, with no related B
(a.b_id = None
).
Now let's instanciate a B
without saving it (b.id = None
).
At this point, b.a
incorrectly returns the instance of a created above -- because it's the only A
with a.b_id == b.id
. b.a
should raise A.DoesNotExist
instead.
Attachments (1)
Change History (2)
by , 12 years ago
Attachment: | 19089.patch added |
---|
comment:1 by , 12 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
This is duplicate of #18153 (thanks Ramiro).