Fabio,
The only reasons I can think of for this kind of denormalization of
the database are performance (as you mentioned, unsignificant benefit
here) or using the resulting value in a filter condition.
The latter can be better worked around by mixing raw SQL with Django's
ORM expressions (with
Chris Amico wrote:
[...]
> Awesome. That worked. Thanks all.
> > > Class Item(models.Model):
> > > name = models.CharField(max_length=100)
> > > price = models.DecimalField(max_digits=9, decimal_places=2)
> > > quantity = models.IntegerField(default=1)
> > > total_cost = models.De
Awesome. That worked. Thanks all.
On Aug 25, 4:14 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2008-08-25 at 15:58 -0700, Chris Amico wrote:
> > Changed the variable names to make it a little more readable. Method
> > now returns "amount" (formerly "total"):
>
> > Class Item(model
On Mon, 2008-08-25 at 15:58 -0700, Chris Amico wrote:
> Changed the variable names to make it a little more readable. Method
> now returns "amount" (formerly "total"):
>
> Class Item(models.Model):
> name = models.CharField(max_length=100)
> price = models.DecimalField(max_digits=9, deci
Changed the variable names to make it a little more readable. Method
now returns "amount" (formerly "total"):
Class Item(models.Model):
name = models.CharField(max_length=100)
price = models.DecimalField(max_digits=9, decimal_places=2)
quantity = models.IntegerField(default=1)
tot
Should 'total_cost' simply:
return total
instead of:
return total_cost(total)
On Aug 25, 5:22 pm, Chris Amico <[EMAIL PROTECTED]> wrote:
> This seems like it should be simple, but I'm getting errors.
>
> I have a model tracking individual purchases. User inputs an item cost
> and quantity; I w
On Mon, Aug 25, 2008 at 5:22 PM, Chris Amico <[EMAIL PROTECTED]> wrote:
>
> This seems like it should be simple, but I'm getting errors.
>
> I have a model tracking individual purchases. User inputs an item cost
> and quantity; I want the total cost calculated. Here are the relevant
> parts:
>
> c
7 matches
Mail list logo