Code

Opened 6 years ago

Closed 6 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: UI/UX:

Description

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.

Attachments (0)

Change History (3)

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

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 6 years ago by emulbreh

This looks like a duplicate of #6915.

comment:3 Changed 6 years ago by anonymous

  • Resolution set to duplicate
  • Status changed from new to closed

duplicate of #6915.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.