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)
Change History (7)
by , 19 years ago
Attachment: | insert_update_signals.diff added |
---|
comment:1 by , 19 years ago
Cc: | added |
---|
comment:2 by , 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 , 19 years ago
Attachment: | insert_update_signals2.diff added |
---|
Signals are sent after insert/update
comment:3 by , 18 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:4 by , 17 years ago
Keywords: | feature added |
---|
comment:5 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
There's currently a "created" flag on the post-save hook, so I'm marking this fixed.
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?