Opened 7 years ago

Closed 7 years ago

#6186 closed (invalid)

New signal needed - post_create

Reported by: italomaia Owned by: nobody
Component: Uncategorized Version: master
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 Changed 7 years ago by pytechd <pytechd@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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