Alright
On Sat, 19 Sep 2020 at 21:32, Arpana Mehta wrote:
> You can use @property
>
> On Sat, 19 Sep 2020, 20:45 eankomah, wrote:
>
>> I have two fields:
>> quantity = models.FloatField()
>> unit_price = models.FloatField()
>>
>> and i want ot do someting like this
>>
>>
>> total_pr
You can use @property
On Sat, 19 Sep 2020, 20:45 eankomah, wrote:
> I have two fields:
> quantity = models.FloatField()
> unit_price = models.FloatField()
>
> and i want ot do someting like this
>
>
> total_price = models.FloatField('unit_price' * 'quantity')
>
> Thanks
>
> --
> You
Create a model and add functions if you want to go more deep use
Model-manager.
On Sun, Sep 20, 2020 at 12:27 AM coolguy
wrote:
> Create a function at class level like this..
>
> *class xxx(models.Model):*
> quantity = models.FloatField()
> unit_price = models.FloatField()
>
>
Create a function at class level like this..
*class xxx(models.Model):*
quantity = models.FloatField()
unit_price = models.FloatField()
* def get_total_price(self):*
return self.quantity * self.unit_price
On Saturday, September 19, 2020 at 11:15:30 AM UTC-4 e
I have two fields:
quantity = models.FloatField()
unit_price = models.FloatField()
and i want ot do someting like this
total_price = models.FloatField('unit_price' * 'quantity')
Thanks
--
You received this message because you are subscribed to the Google Groups
"Django users" gr
5 matches
Mail list logo