From 0cfbc38eda63dd8af649b78210bfa5f69dac868a Mon Sep 17 00:00:00 2001 From: ilia Date: Fri, 21 Oct 2022 23:37:26 +0300 Subject: [PATCH] add service --- app/search/services/hints.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 app/search/services/hints.py diff --git a/app/search/services/hints.py b/app/search/services/hints.py new file mode 100644 index 0000000..062c71f --- /dev/null +++ b/app/search/services/hints.py @@ -0,0 +1,8 @@ +from search.models import Product, Category + + +def get_hints(content: str) -> str: + category = 'Unknown' + if content in list(map(lambda product: product.name, Product.objects.all())): + category = 'Name' + return category