Code

Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#280 closed enhancement (fixed)

add _pre_delete and _post_delete hooks

Reported by: anonymous Owned by: jacob
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Currently one can define _pre_save and _post_save methods on a model, but no _*_delete methods. It's a useful feature missing, and trivial to implement. Just adding "if hasattr(self, '_pre_delete'): self._pre_delete()" (and the same for _post_delete) to method_delete() on
django/core/meta/init.py and two paragraphs documenting them on docs/model-api.txt .

Attachments (0)

Change History (2)

comment:1 Changed 9 years ago by jacob

  • Owner changed from adrian to jacob
  • Status changed from new to assigned

comment:2 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [432]) Fixed #280 -- Added _pre_delete() and _post_delete() hooks. Also updated the docs and added a unit testdjango/core/meta/init.py

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.