Saturday, September 19, 2020

Re: Calculated feild in models

Alright 

On Sat, 19 Sep 2020 at 21:32, Arpana Mehta <arpana11mehta@gmail.com> wrote:
You can use @property 

On Sat, 19 Sep 2020, 20:45 eankomah, <csceankomah@gmail.com> 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 received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a7844b0c-1db7-4c13-911d-e2e80e9a7bf6n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGyqUuXJx3gesby7EE7s8%2Bvsk2WP9azTFoHoT2y8Y6hMJsoS6A%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAELEq4ROSOAGo-zRG4T04sa7FgH2Yw4wH8D9TYFoBoB6BBjBaA%40mail.gmail.com.

No comments:

Post a Comment