我正在使用 django oscar 开发一个电子商务网站。
产品已列出,我必须应用过滤器(例如年份、价格等)。我们可以使用 oscar facet 来实现此过滤功能吗?
我尝试添加以下内容奥斯卡文档 http://django-oscar.readthedocs.org/en/latest/ref/settings.html#oscar-search-facets,但不知道如何让它在我的前端工作和渲染。
OSCAR_SEARCH_FACETS = {
'fields': OrderedDict([
('product_class', {'name': _('Type'), 'field': 'product_class'}),
('rating', {'name': _('Rating'), 'field': 'rating'}),
]),
'queries': OrderedDict([
('price_range',
{
'name': _('Price range'),
'field': 'price',
'queries': [
# This is a list of (name, query) tuples where the name will
# be displayed on the front-end.
(_('0 to 20'), u'[0 TO 20]'),
(_('20 to 40'), u'[20 TO 40]'),
(_('40 to 60'), u'[40 TO 60]'),
(_('60+'), u'[60 TO *]'),
]
}),
])
}
是否可以用它来过滤产品,或者还有其他方法吗?