Opened 19 years ago

Closed 17 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: dev
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

Description

This patch adds two new signals: save_update and save_insert.
They are called from the Models.save()-method, 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@…> 19 years ago.
insert_update_signals2.diff (1.4 KB ) - added by mhf@… 19 years ago.
Signals are sent after insert/update

Download all attachments as: .zip

Change History (7)

by Matias Hermanrud Fjeld <mhf@…>, 19 years ago

Attachment: insert_update_signals.diff added

comment:1 by mir@…, 19 years ago

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 by mhf@…, 19 years ago

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.

by mhf@…, 19 years ago

Attachment: insert_update_signals2.diff added

Signals are sent after insert/update

comment:3 by Simon G. <dev@…>, 18 years ago

Triage Stage: UnreviewedDesign decision needed

comment:4 by Philippe Raoult, 17 years ago

Keywords: feature added

comment:5 by Jacob, 17 years ago

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