You need to look at overriding the model's save method in order to add
data from one field to another dynamically.

http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-model-methods




On Aug 19, 2: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)
>   ...
>
> 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

-- 
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.

Reply via email to