On Wed, Feb 25, 2009 at 3:56 PM, bretro...@gmail.com <bretro...@gmail.com>wrote:
> > This is working fine in my custom interface, but the admin is broken > now since it is not passing the argument to the save() function. > > On Feb 23, 5:56 pm, "bretro...@gmail.com" <bretro...@gmail.com> wrote: > > Perfect. Thanks! > > > > On Feb 23, 5:51 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > > > > > On Mon, Feb 23, 2009 at 5:40 PM, bretro...@gmail.com < > bretro...@gmail.com>wrote: > > > > > > Hello, > > > > > > I'd like to send an email when a Model is saved via it's ModelForm. > > > > I'm aware that I can override thesavefunctionof the model, then > > > > call it's super but I was wondering how topassrequest.user.username > > > > to the Model'ssavefunction. Or if someone has a better suggestion > > > > I'd be willing to use it. > > > > > > -Bret > > > > > The easiest way would just to do: > > > > > defsave(self, username): > > > obj = call super with commit = false > > > obj.save(username) > > > return obj > > > > > Just add this method to the ModelForm and you're golden. > > > > > Alex > > > > > -- > > > "I disapprove of what you say, but I will defend to the death your > right to > > > say it." --Voltaire > > > "The people's good is the highest law."--Cicero > > > Perhaps this hook could be of assistance: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#save-model-self-request-obj-form-change Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---