Sunday, October 31, 2010

Re: Call a function after a model with inlines is created

On Oct 31, 4:46 pm, Martin Tiršel <dja...@blackpage.eu> wrote:
> Hello,
>
> I have two models BillingRequest and BillingRequestItem. I am using admin  
> and inlines, so when I am creating BillingRequest, I have some fields for  
> BillingRequestItems. Now, I need to send an email with some information  
>  from both models when I create new BillingRequest record. But I don't  
> know, where I should put the code. It have to be after all models are  
> saved, but where/when is it?
>
> Thanks,
> Martin

If this is only needed for the admin, you probably want to override
the ModelAdmin's response_add method. This is called after the add
form has been processed and all the resulting objects saved. Be sure
to call (and return) the super method after you've done your
processing.
--
DR.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment