On Thu, Aug 26, 2010 at 12:02 PM, Alessandro Ronchi <
alessandro.ron...@soasi.com> wrote:

> I need to be sure that an inline model is saved every time I save its
> parent class.
> I need it because I want to save the last modified timestamp, and I don't
> want to overwrite the parent save because I want to track only admin saves.
>
> I cannot touch the parent class because it came from a library.
>
> Is it possible?
>

Yes. Override save_formset for the ModelAdmin containing the inline:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_formset

Note the formset.save() only returns the modified objects -- the ones that
based on data changing appear to need to be saved. You'll also need to save
any of the initial forms (formset.initial_forms) that don't appear to be
modified, if you want to save all of the objects even if the form data has
not changed from initial values.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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