A
A
Alexander2018-10-01 13:39:02
Django
Alexander, 2018-10-01 13:39:02

How to do a like search from a django base?

The search bar, I enter a part of the name of the product, should give out this product, now it is implemented like this:

question = request.GET.get('q')
    products_images = ProductImage.objects.filter(is_active=True, is_main=True, product__is_active=True, product__product_name = question)

And he finds a product with exactly that name, but he needs to share it and find it with a similar one, for example, I enter polo and he finds products for me: Polo black, Polo Lacost white, etc. How to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-10-01
@AleksandrB

https://docs.djangoproject.com/en/2.1/ref/models/q...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question