Wednesday, October 29, 2014

Re: how to save in inline form total sum

Hello,

the only problem that is save correct total sum but a hit 2 o 3 time button save in the admin, not first time
why? i don't know :(

It's probably because ModelA is saved before the individual ModelB's.

You could calculate this _after_ the ModelB inlines(?) have been saved using the save_related hook.
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_related

Collin

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/efbbf510-64f5-480d-bad7-2734e9f3d6da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment