Opened 19 months ago

Last modified 15 months ago

#28147 assigned Bug

Saving parent object after setting on child leads to unexpected data loss

Reported by: Erwin Junge Owned by: Amy Mok
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords:
Cc: Tim Martin Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description (last modified by Erwin Junge)

When saving a parent object after setting it on a child object and then saving the child object, no error is thrown but the FK relation is saved with a NULL value.

Failing testcase:

        # Create parent and child, save parent, save child, parent_id should be set
        p = Parent()
        c = Child(parent=p)
        self.assertIs(c.parent, p)

Patch available:

Change History (5)

comment:1 Changed 19 months ago by Erwin Junge

Description: modified (diff)

comment:2 Changed 19 months ago by Erwin Junge

Owner: changed from nobody to Erwin Junge
Status: newassigned
Version: 1.11master

comment:3 Changed 19 months ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:4 Changed 15 months ago by Amy Mok

Owner: changed from Erwin Junge to Amy Mok

comment:5 Changed 15 months ago by Tim Martin

Cc: Tim Martin added
Patch needs improvement: set

The current PR has merge conflicts that need to be resolved.

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