khue bui khue bui - 24 days ago 6
Python Question

Haystack django SearchQuerySet

I'm using Haystack Django for search engine.

SearchQuerySet().filter(**conds)


the conds may include :

conds['name'] = Exact(name)
conds['category'] = Exact(category)
conds['city_id'] = Exact(city_id)


but beside I also want to add list of sub_category as conditions, so is there any way to add something like

conds['sub_category'] = list(city_id)

Answer

OK, the question seem to not clearly, I meant I want to add the key sub_category into the dictionary conds that values are list. So i found this way could answer the question above:

conds['sub_categary__in']  = sub_category_list