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 in admin inlines self.total_men = sum(map(sum, ModelB.objects.filter(choice__in = [1,2,3], modela_id = self.id).values_list('men',))) self.total_total_women = sum(map(sum, ModelB.objects.filter(choice__in = [1,2,3], modela_id = self.id ).values_list('women',))) super(ModelA, self).save(*args, **kwargs) 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 :( any idea Cheers On Fri, Oct 24, 2014 at 10:25 AM, carlos <crocha09...@gmail.com> wrote: > Ok, i try en modelA create the total, thank for idea > > Cheers > > On Fri, Oct 24, 2014 at 6:34 AM, Collin Anderson <cmawebs...@gmail.com> > wrote: > >> 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 = 8 >>> >> >> Right, it seems to me that the "total" need to be on a separate model >> from the individual counts, maybe on ModelA? >> >> 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+unsubscr...@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/b74cd978-1158-4076-9b33-ec38ec25ebbb%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/b74cd978-1158-4076-9b33-ec38ec25ebbb%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAM-7rO2HL3gH2H9MtNydL820HeYhf3efxBMvDuWANuSUr%2BioAg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.