mirror of
https://github.com/magnum-opus-tender-hack/backend.git
synced 2024-11-10 19:46:35 +03:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
f823bcff62
|
@ -1,6 +1,6 @@
|
|||
from typing import List, Dict
|
||||
|
||||
from search.models import Product, Category, Characteristic
|
||||
from search.models import Product, Category, Characteristic, UnitCharacteristic
|
||||
|
||||
|
||||
def autocomplete_schema(val: str, exclude: List[Dict]):
|
||||
|
@ -46,4 +46,15 @@ def autocomplete_schema(val: str, exclude: List[Dict]):
|
|||
].values("name", "value")
|
||||
]
|
||||
)
|
||||
schema.extend(
|
||||
[
|
||||
{
|
||||
"coordinate": char["value"].lower().index(val.lower()),
|
||||
"value": {
|
||||
"type": char["name"] + "_numeric",
|
||||
"value": char["value"]
|
||||
}
|
||||
} for char in UnitCharacteristic.objects.filter(value__unaccent__icontains=val)[:20].values("name", "value")
|
||||
]
|
||||
)
|
||||
return schema
|
||||
|
|
Loading…
Reference in New Issue
Block a user