Re: adding a summary field to a model

2010-08-20 Thread bruno desthuilliers
On 20 août, 00:32, widoyo wrote: > Try to add function 'quota_ore' below. > > On Aug 19, 3:03 am, djnubbio 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)

Re: adding a summary field to a model

2010-08-19 Thread djnubbio
yes you are right. Howto? On 19 Ago, 17:47, Mathieu Leduc-Hamel wrote: > But by the way you field seem to be a sum of some others, maybe it should > not be a new field but just a new method returing the resulting calculation > depending of the attributes of your instance. No ? > > On Thu, Aug 19,

Re: adding a summary field to a model

2010-08-19 Thread djnubbio
in fact I DO NOT want denormilize On 19 Ago, 16:56, bruno desthuilliers wrote: > On 19 août, 16:25, Nick wrote: > > > You need to look at overriding the model's save method in order to add > > data from one field to another dynamically. > > Useless denormalization (until proved otherwise of cour

Re: adding a summary field to a model

2010-08-19 Thread djnubbio
Hu, denormalizing...it isn't best solution On 19 Ago, 16:25, Nick wrote: > 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-mod... > > On Aug 19, 2:03 am,

Re: adding a summary field to a model

2010-08-19 Thread djnubbio
tank very much, widoyo. It was what i was looking for...and It works. On 20 Ago, 00:32, widoyo wrote: > Try to add function 'quota_ore' below. > > On Aug 19, 3:03 am, djnubbio wrote:> Sorry for > wasting your preciuose time. I'm very newby in django. > > > I have de following > > > class Comme

Re: adding a summary field to a model

2010-08-19 Thread widoyo
Try to add function 'quota_ore' below. On Aug 19, 3:03 am, djnubbio 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_digi

Re: adding a summary field to a model

2010-08-19 Thread tsmets
You replied faster than me Mathieu :) It looks the easiest solution unless the SUM is potentially heavy on the system... There are of course other means to circumvent the issue but it going further & further in the denormalization process (it is not an issue per se ... you just have to be aware of

Re: adding a summary field to a model

2010-08-19 Thread Mathieu Leduc-Hamel
But by the way you field seem to be a sum of some others, maybe it should not be a new field but just a new method returing the resulting calculation depending of the attributes of your instance. No ? On Thu, Aug 19, 2010 at 4:56 PM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > O

Re: adding a summary field to a model

2010-08-19 Thread bruno desthuilliers
On 19 août, 16:25, Nick wrote: > You need to look at overriding the model's save method in order to add > data from one field to another dynamically. Useless denormalization (until proved otherwise of course...). -- You received this message because you are subscribed to the Google Groups "Dja

Re: adding a summary field to a model

2010-08-19 Thread Nick
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 wrote: > Sorry for wasting your preciuose time. I'm very newby in dja

Re: adding a summary field to a model

2010-08-19 Thread bruno desthuilliers
On 19 août, 09:03, djnubbio 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

adding a summary field to a model

2010-08-19 Thread djnubbio
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('da