On 6/19/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
...
> Now, if I set up a join table (a DocumentRecipient model with Document
> and Recipient as foreign keys) and override the DocumentRecipient
> save() function to send the email, that works, but that seems like a
> clunky way to do things. Is there a better way using signals or
> something?
You could try using dispatcher, something like this (could be in your
models.py):
from django.dispatch import dispatcher
from django.db.models import signals
...
def my_func(instance):
...
dispatcher.connect(my_func, signal=signals.post_save, sender=MyModel)
If you look in the source for Model.save(), in
django/db/models/base.py you'll see where the pre and post save hooks
are called.
--
Derek
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---