V
V
Vova1357982021-07-18 16:14:00
Django
Vova135798, 2021-07-18 16:14:00

How to display a percentage discount?

The Product model has two fields: regular price and discounted price. It is necessary to do something so that if there is a discount, the percentage of the discount is also displayed. I think that you need to add a function to the model that will perform mathematical operations, and display the result in a new field of the model. Can this be done in a better way?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alternativshik, 2021-07-19
@alternativshik

It is possible, at the stage of editing the price of the product, to record 2 prices and immediately calculated%

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question