Opened 17 years ago

Closed 17 years ago

#6186 closed (invalid)

New signal needed - post_create

Reported by: italomaia Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords: signals
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Well, i was thinking, if there is a post_delete signal, why not a post_create signal? Like, if someone wants something
to be executed when a model is created agains the database, and NOT when it is saved!
It would be very useful for counters, for example.

Change History (1)

comment:1 by pytechd <pytechd@…>, 17 years ago

Resolution: invalid
Status: newclosed

You can already do this (from source:/django/trunk/tests/modeltests/signals/models.py)

def post_save_test(sender, instance, **kwargs):
    print 'post_save signal,', instance
    if 'created' in kwargs:
        if kwargs['created']:
            print 'Is created'
        else:
            print 'Is updated'

dispatcher.connect(post_save_test, signal=models.signals.post_save)
Note: See TracTickets for help on using tickets.
Back to Top