Re: adding a summary field to a model
On 19 août, 09:03, 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)
> ...
>
> 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)
>
> for each item in commessa.
>
> any suggestion will be greatly appreciated; tank vwry much in advance
Start here:
http://docs.djangoproject.com/en/1.2/topics/db/aggregation/#topics-db-aggregation
HTH
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home