将 haystack 集成到我的应用程序中
我已经为显示产品编写了一个自定义平台(例如没有购物车和运输的电子商务)
无论如何,我在 127.0.0.1/myapp/search 上启动并运行了 haystack,我可以执行搜索,结果完美返回,并且一切正常。
这是我的工作网址
目前我的搜索文件,重定向到一个空的base.html(带有内容块)
现在,您可以通过我的 urls.py 文件看到,我的产品是通过自定义 url + 视图条目加载的。
这会将我重定向到一个名为detail.html 的模板,其中包含(您猜对了)根据已加载的产品的详细信息。
现在,当我尝试将我的search.html 文件包含到我的detail.html(与我的/search 条目使用的相同)中时,代码无法正确呈现,它显示了表单方法,但没有其他内容。
我要问的是,如何才能将我的 haystack 搜索代码加载到我的detail.html 页面中。
谢谢。
I have written a custom platform for display products (like ecommerce with no carts and shipping)
Anywway, I have haystack up and running at 127.0.0.1/myapp/search, I can perform searches, the results return perfectly and all works as it should.
here is my working urls
And currently my search file, which redirects to an empty base.html (with the content block)
Now as you can see via my urls.py file, my products are loaded via a custom url + view entry.
This redirects me to a template called detail.html, which contains (you guessed it) detailed information according to what product has been loaded.
Now when I try and include my search.html file into my detail.html (the same one used with my /search entry) the code doesnt render correctly, it shows the form method, but nothing else.
What I am asking is, how can I get my haystack search code to load in my detail.html page.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
猜测渲染
details.html
模板时未设置form
上下文变量。覆盖 DetailView 并为表单设置额外的上下文数据应该使表单显示在页面上,如下所示:Guessing that
form
context variable is not set whendetails.html
template is rendered. Override DetailView and set extra context data for form should make form to appear on page, something like this: