On Oct 13, 1:53 pm, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 13 oct, 18:11, Joe Sr <[EMAIL PROTECTED]> wrote: > > > I am working on an "Issues" application and I want to execute code to > > send an e-mail to an assignee after an issue has been added. I saw > > that there are signals I can intercept for pre- and post-save, but how > > could I only limit to insert and not update events? > > From the doc: > > """ > django.db.models.signals.post_save > > Like pre_save, but sent at the end of the save() method. > > Arguments sent with this signal: > > sender > The model class. > instance > The actual instance being saved. > created > A boolean; True if a new record was create. > """ > > http://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.si...
Thank you for your response. I found a way which is more straightforward to me: class Issue(models.Model): id = models.AutoField(primary_key=True) def save(self): if self.id is None: # New instance # Do stuff without needing actual id value super(Issue, self).save() # Now we have an id and can use it here. else: # Save existing super(Issue, self).save() --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---