Having these Models... class Parent(models.Model): date = models.DateField() n = models.IntegerField(default = 0)
class Kind1(Parent): def total(self): return cantidad * 3 class Kind2(Parent): def total(self): return cantidad * 2 How can I do this ? for p in Parent.objects.all().order_by('-date'): print p.total() #this should print self.n * 2 or self.n * 3 depending the case What I did was: k1 = Kind1.objects.all().order_by('-date') k2 = Kind2.objects.all().order_by('-date') objects = itertools.chain(k1, k2) for o in objects: print o.total() But I think is not a correct solution, what do you think ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---