Opened 14 years ago

Closed 13 years ago

#2154 closed enhancement (fixed)

[patch] save_insert and save_update signals

Reported by: Matias Hermanrud Fjeld Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: minor Keywords: feature
Cc: mir@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


This patch adds two new signals: save_update and save_insert.
They are called from the, when an update statement is executed,
or when an insert statement is executed, respectivly.

Attachments (2)

insert_update_signals.diff (1.5 KB) - added by Matias Hermanrud Fjeld <mhf@…> 14 years ago.
insert_update_signals2.diff (1.4 KB) - added by mhf@… 14 years ago.
Signals are sent after insert/update

Download all attachments as: .zip

Change History (7)

Changed 14 years ago by Matias Hermanrud Fjeld <mhf@…>

Attachment: insert_update_signals.diff added

comment:1 Changed 14 years ago by mir@…

Cc: mir@… added

Interesting ... I'm adding some auditlog to my app, and I'd rather in need of a post_insert, so that the primary key has been assigned when the signal is sent. What are you using this for?

comment:2 Changed 14 years ago by mhf@…

I have a dyndns app, and to have it update dns-entries when the hostname is changed, I need to distinguish between inserts and updates:

a host object is created -> do nothing.
a host object is changed -> update dns.

But I don't really need the signals before, so i've included a new patch that sends the signals after updates/inserts.
Maybe this should be four signals: {pre,post}_{update,insert}? It'll probably have to wait untill somebody asks for it.

Changed 14 years ago by mhf@…

Attachment: insert_update_signals2.diff added

Signals are sent after insert/update

comment:3 Changed 13 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedDesign decision needed

comment:4 Changed 13 years ago by Philippe Raoult

Keywords: feature added

comment:5 Changed 13 years ago by Jacob

Resolution: fixed
Status: newclosed

There's currently a "created" flag on the post-save hook, so I'm marking this fixed.

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