Thanks!

I've got it working now:

def mail_on_create_intro(sender, instance, created, **kwargs):
     if created:
         email_body =  'A new Intro at' + instance.url
         email_subject = 'New Intro'
     else:
         email_body = 'An intro has changed at' + instance.url
         email_subject = 'Changed Intro'
     mail_managers(email_subject, email_body)

It wasn't quite clear to me from the documentation at 
http://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.signals.post_save
 
  that you actually have to pass the arguments 'instance' and 'created'.
-benjamin


> Or:
>
> def mail_on_create_intro(sender, created=None, **kwargs):
>     if created:
>         email_body = 'A new intro at ' + instance.url
>         email_subject = 'New intro'
>     else:
>         email_body = 'An intro has changed at ' + instance.url
>         email_subject = 'Changed Intro'
>     mail_managers(email_subject, email_body)

>>
>> Try:
>>
>> if 'created' in kwargs:
>>       if kwargs['created']:
>>            # Send email


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to