On Thu, 2007-11-29 at 15:28 -0800, Ryan K wrote:
> I have a model called a course that when created needs to insert
> several classes (another model) into the schedule model. Is it best to
> override the course's save method or use the dispatcher? Is there any
> difference for this use case?

As a general guideline, if the function you are writing is designed to
be called by all models (or most models: it'll be called for all models
and you can immediately return for those types you don't care about),
use a signal handler. If it's only called from one, or a few, models,
call it from the respective save() methods.

As a practical matter, bear in mind that you cannot, for example, add
many-to-many objects to a new instance until you have called
Model.save(), so if you're trying to do that in your save() method,
remember to call the superclass save() before adding many-to-many
related objects.

Regards,
Malcolm



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