It's something related with "dispatcher" class? Please let me know if there is
more about signals than the code below. I simply just use this;
-----
...
...
from django.db.models import signals
from django.dispatch import dispatcher
from myapp.signal_handlers import do_something_before_adding
class FooModel(models.Model)
.....
.....
dispatcher.connect(do_something_before_adding, signal=signals.pre_save,
sender=FooModel)
-----
This code will call "do_something_before_adding" before the object is created.
I don't know what parameters are appended to function, but just do triald and
error :) I hope, this will help you Julien.
Btw, in the "django.db.models.signals", these signals exist;
class_prepared
pre_init
pot_init
pre_save
post_save
pre_delete
post_delete
post_syncdb
If you use post_save instead of pre_save, your signal handler is passed
a 'created' flag.
Michael
That's the correct way to do it, unless you want to use signals:
http://www.martin-geber.com/weblog/2007/10/29/django-signals-vs-custom-save-method/
Michael