Opened 10 years ago

Closed 10 years ago

#7360 closed (duplicate)

Documentation should be clearer about when save and delete are called.

Reported by: Richard Bell <rbell01824@…> Owned by: nobody
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


An hour later I know what caused the behavior and it seems to me to be a Django bug or at least deficiency.

This behavior occurred during an initialization of the application.

First the table xx_xxnode was initialized by deleting all of its records and then reloading the table from an external source. It has a character field primary key.

Then the table xx_xxraid needs to be initialized. xx_xxraid has a foreign key to the table xx_xxnode. However, when xx_xxnode's records were deleted, Django also deleted the linked records in xx_xxraid since the keys were no longer valid. All of which is OK and if I read the documents closely is in fact documented.

However, there is a problem. The model for xx_xxraid overrides the delete method. While the records in xx_xxraid are in fact being deleted as an (appropriate) side effect of the delete of xx_node's records the delete method of xx_xxraid is NOT being invoked. It seems likely that add and delete are overrides associated with the admin interface NOT, sadly, with the DB API.

No joy, but at least I know what is going on.

Change History (3)

comment:1 Changed 10 years ago by Richard Bell <rbell01824@…>

Additional investigation seems to show that when deleting records in the parent table the delete method of the child table is NOT called. I'm inclined to think this is a bug not a documentation issue.

comment:2 Changed 10 years ago by Johannes Dollinger

This looks like a duplicate of #6915.

comment:3 Changed 10 years ago by anonymous

Resolution: duplicate
Status: newclosed

duplicate of #6915.

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