I
I
IvanOne2018-02-05 07:58:31
Django
IvanOne, 2018-02-05 07:58:31

How to make a price filter?

Hello. There is a simple store that I wrote in plain django. The client here wanted to introduce all sorts of discounts and promotions, I decided to make a price through https://github.com/mirumee/django-prices. Everything in general is great except for filtering goods. The essence of the problem is that the original price is stored in the database, when a product is requested, the price is formed already taking into account discounts. That is, if the product cost 3,000 and became 2,000, then in the search from 1,000 to 2,000 it will not fall out. So far, I have chosen two options for myself, either to fasten some kind of engine like Elasticsearch, and also hang a full site search on it, or make an additional field in the table with the product, and store the current price there, taking into account discounts. Maybe there are more options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TheRevan, 2018-02-05
@TheRevan

You can insert the price calculation logic into sql query

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question