On Sunday 12 February 2017 09:55:16 Mike Dewhirst wrote:
> A mixture has a number of ingredients and the proportions should
> (eventually) sum to 100%
> 
> Ingredients are substances connected to the mixture - also a substance
> -  via m2m relationships. Each m2m record carries an ingredient
> proportion value.
> 
> If a proportion changes the sum total changes after saving the mixture
> but cannot be displayed in the parent until the following save.

The trick is not to focus on saving, but on providing a consistent state when 
loading the model instance, similar as to what ImageField does with it's width 
and height fields.

Here's an example:
https://gist.github.com/melvyn-sopacua/1b4e4585ab15ffc176798c083470cf04
-- 
Melvyn Sopacua

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/23299145.1Vr2hP29hy%40devstation.
For more options, visit https://groups.google.com/d/optout.

Reply via email to