tank very much, widoyo. It was what i was looking for...and It works. On 20 Ago, 00:32, widoyo <wid...@gmail.com> wrote: > Try to add function 'quota_ore' below. > > On Aug 19, 3:03 am, djnubbio <giuseppe.nati...@gmail.com> wrote:> Sorry for > wasting your preciuose time. I'm very newby in django. > > > I have de following > > > class Commessa(models.Model): > > commessa = models.CharField(max_length=20) > > quota_oraria=models.DecimalField(max_digits=5, decimal_places=2) > > ... > > def quota_ore(self): > self.quota_oraria * sum([d.ore for d in self.diario_set.all()]) > > > class Diario(models.Model): > > data= models.DateField('data inizio') > > commessa = models.ForeignKey(Commessa) > > ore=models.IntegerField() > > ... > > > I want to add a column to Commessa containg the result of: > > > quota_oraria * sum(ore) > > Widoyo
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.