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 the save function of the model, then
> call it's super but I was wondering how to pass request.user.username
> to the Model's save function.  Or if someone has a better suggestion
> I'd be willing to use it.
>
> -Bret
>
> >
>
The easiest way would just to do:

def save(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

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

Reply via email to