create django model field based on another field
- Create a Django model with the desired fields.
- Use the
models.DecimalField
field to define the base field. - Use the
property
decorator to define a method that will calculate the new field based on the base field. - Use the
@property.setter
decorator to define a method that will set the base field based on the new field if needed.