On 2/9/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > Using the signal system might be overkill here. Can you achieve whatever > you want with your own save() method (remember that you can then call > the model's default save() method after doing your own stuff)? >
Malcom, Thanks for the quick reply. This was my original thought... yes, I can do what I want in my own save() method, but it feels inelegant (and, in my case, would violate DRY). It seems like post-object-creation logic could be a common design pattern in more complex applications, so a signal might be worth consideration. Also, a signal would solve this problem in the case of a self-assigned pk value... though it's not an issue for me. For those following along at home, Malcom's suggestion could be implemented as something like the following.... =============== class MyModelName(models.Model): def save(self): pre_save_id = self.id super(MyModelName, self).save() if not pre_save_id: ... my code ... =============== Thanks, - Ben --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---