Re: how to save in inline form total sum

2014-10-29 Thread Collin Anderson
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

Re: how to save in inline form total sum

2014-10-28 Thread carlos
Hi, +Collin i update my ModelA and now is this: class ModelA(models.Model): field1 = charfield(...) field2 = integeterfield() total_men = integerField(editable=False) total_women = integerField(editable=False) def save(self, *args, **kwargs): #this is for sum all 3 data put

Re: how to save in inline form total sum

2014-10-24 Thread carlos
Ok, i try en modelA create the total, thank for idea Cheers On Fri, Oct 24, 2014 at 6:34 AM, Collin Anderson wrote: > Hello, > > >> ModelB in inline >> choice men women >> option1 6 4 >> option2 1 3 >> optio

Re: how to save in inline form total sum

2014-10-24 Thread Collin Anderson
Hello, > ModelB in inline > choice men women > option1 6 4 > option2 1 3 > option3 2 1 > > i need save in other field total this sum for example men = 9 and women > total is =

Re: how to save in inline form total sum

2014-10-23 Thread carlos
Hi +Collin the idea is sum all data for example de model is class ModelB(models.Model): choice = models.Integerfield(choices='CHOICE_TYPE') men = models.IntegerField() women = models.IntegerField() total_men = integerField(editable=False) total_women = integerField(editable=Fal

Re: how to save in inline form total sum

2014-10-23 Thread Collin Anderson
Hello, I'm not sure what you're trying to do, but to fix the None error set default=0 on the total columns. Or do something like this: self.total_men = (self.total_men or 0) + (self.men or 0) Thanks, Collin -- You received this message because you are subscribed to the Google Groups "Django

how to save in inline form total sum

2014-10-21 Thread carlos
Hi, i need sum inlines field but i no have idea example for more clean, i have 2 models in models.py i have: class ModelA(models.Model): field1 = charfield(...) field2 = integeterfield() . CHOICE_TYPE = ((1,"option1"),(2,"option2"),(3,"option3")) class ModelB(models.Model):