On 7/3/06, Spock <[EMAIL PROTECTED]> wrote:
> after_create is a hook executed when commit in database is made when
> new record is craeted:

You can accomplish the same thing by adding a custom 'save' method on
the model[1]; Django used to offer '_pre_save' and '_post_save'
methods, but anything you could do with them you can do now in 'save'
-- to get "pre-save" functionality put code before the call to the
parent class' 'save' method, and to get "post-save" functionality put
code after.

You can also differentiate between the initial save and later updates
by checking -- before calling the parent class' 'save' method --
whether the object has an ID; if it doesn't, then the object is being
created for the first time, and if it does then it's an update to an
existing object.

Depending on what exactly you need to do, it may be cleaner to
implement it this way than to use the dispatcher.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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

Reply via email to