django-disqus 不使用 set_disqus_url 或 set_disqus_identifier

发布于 2024-11-02 02:24:12 字数 735 浏览 1 评论 0原文

我使用了旧版本的 https://github.com/arthurk/django-disqus/ 过去。当我升级到 0.4 时,新的模板标签 set_disqus_url 和 set_disqus_identifier 似乎不起作用。

我想 {% set_disqus_identifier "test" %} 应该在模板中设置 var disqus_identifier = 'test'; ,对吗?

最后,我按照安装说明设置了站点、api 密钥和短名称。将 var disqus_identifier = 'test'; 放入模板中即可。 那么,是不是 django-disqus 坏了?

编辑:django-disqus 的开发人员告诉我,将这些标签与 {% disqus_show_comments %} 放在同一个块中非常重要,这当然在文档 http://django-disqus.readthedocs.org/ en/latest/templatetags.html#disqus-show-comments

I have used an old version of https://github.com/arthurk/django-disqus/ in the past. When I upgraded to 0.4, the new template tags, set_disqus_url and set_disqus_identifier, doesn't seem to work.

I guess {% set_disqus_identifier "test" %} should set var disqus_identifier = 'test'; in the template, right?

Finally, I have followed the installation instruction, setting the SITE, api key and shortname. Putting var disqus_identifier = 'test'; in the template works.
So, could it be that django-disqus is broken?

EDIT: The developer of django-disqus told me that it is important to have these tags in the same block as {% disqus_show_comments %}, which of course is mentioned in the docs http://django-disqus.readthedocs.org/en/latest/templatetags.html#disqus-show-comments.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

意中人 2024-11-09 02:24:12

我认为这已经解决了,但可能对其他人有用。是否是您忘记加载 disqus 标签:

some_template.html

# load the tags
{% load disqus_tags %}
# get comments for your website
{% disqus_show_comments "YOUR_WEBSITE_SHORTNAME" %}
# get the url for the current object to get the right comments
{% set_disqus_url object.get_absolute_url %}

I think this is solved but may be it is useful for someone else. Could it be that you forgot to load the disqus tags:

some_template.html

# load the tags
{% load disqus_tags %}
# get comments for your website
{% disqus_show_comments "YOUR_WEBSITE_SHORTNAME" %}
# get the url for the current object to get the right comments
{% set_disqus_url object.get_absolute_url %}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文