0

我最初遵循本教程(https://django-haystack.readthedocs.org/en/latest/tutorial.html),并且到目前为止能够在返回的结果中突出显示我的查询。但是,我想在访问使用单独模板加载的下一页时突出显示相同的查询。有什么方法可以保存/访问这个查询,以便我可以在这个其他模板中突出显示相同的结果?

每当我尝试包含这样的语句时,我都会收到一个错误,我认为这是因为我没有尝试正确访问查询。

{% highlight section.body with query html_tag "span" css_class "highlighted" %}
4

1 回答 1

0

You have to send to the next page, the information that you use to highlight the results in the first page. You can use the request.session to store the data and call it in the next page, or you can send the sqs by the url to the next page.

If you want to know how to manage the search query set, and how to edit that kind of stuff, I recommend you to read the views.py forms.py and the elasticsearch_backend in the haystack folder at: "/usr/local/lib/python2.7/dist-packages/haystack"

This is the url for the documentation of Django Session: Django Session

This is the url for the documentation to pass parameters trhough url: URL dispatcher

于 2013-10-03T12:33:42.937 回答