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=False) fk_model_a = fk(ModelA) def save(self, *args, **kwargs): #this is for sum all 3 data put in admin inlines self.total_men += self.men self.total_women += self.women super(ModelB, self).save(*args, **kwargs) in the admin look liked this: 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 for this reason i create 2 field more total_men = integerField(editable=False) total_women = integerField(editable=False) and create the override save method def save(self, *args, **kwargs): #this is for sum all 3 data put in admin inlines self.total_men += self.men self.total_women += self.women super(ModelB, self).save(*args, **kwargs) but no working :( any idea to save the sums of the inlines options Cheers On Thu, Oct 23, 2014 at 6:15 AM, Collin Anderson <cmawebs...@gmail.com> wrote: > 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 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/a9f82650-d1dd-4350-80e7-22ad491c6aa9%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/a9f82650-d1dd-4350-80e7-22ad491c6aa9%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-7rO247oHNayQrW-ZF0yM75Rb3%2BQrzrSiSKtWpuyh1rGy9fA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.