Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Django]calculate value in model
#1
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:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Photo After using models.Model on my class Im getting 'ImproperlyConfigured' error Django khavro 1 404 Apr-05-2021, 03:11 PM
Last Post: SheeppOSU
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 1,304 Jun-30-2019, 12:21 AM
Last Post: scidam
  Need your help to fix my database relationship in Django model PrateekG 0 1,756 Jul-02-2018, 11:08 AM
Last Post: PrateekG
  Django not saving model in management command F2Andy 1 1,764 Jun-02-2018, 03:17 PM
Last Post: F2Andy
  Django model.py model.foreignkey() HenryJ 1 1,858 Feb-09-2018, 04:21 AM
Last Post: DocSeussMan
  How do I make a Django model from a tab-delimited data file? newbietostuff 0 1,336 Jan-09-2018, 02:44 AM
Last Post: newbietostuff
  Django field model for HTML parser? Drone4four 0 2,752 Nov-15-2017, 02:43 AM
Last Post: Drone4four

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020