Python Forum

Full Version: [Django]calculate value in model
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi I am new to Django

I have a Model with Buying and Selling Rate and have loaded data it.

Now i want to update the Model and a calculative column called Profit like:

Profit=models.FloatField(selling-buying)

It throws error.

What is the correct way to do it, how can i change value for the data which have been loaded earlier from python.

i know we have to do something in default=calculated_value

Kindly help.

Code: https://repl.it/repls/VigorousConsiderableVaporware


Error: