【问题标题】:anchor tag in django template not workingdjango模板中的锚标记不起作用
【发布时间】:2019-10-07 20:06:50
【问题描述】:

在我的 django 项目中,在我的一个模板中,没有锚标记起作用。 这是我的模板代码: layer_details.html

当我点击任何锚点时,网址会显示在浏览器中,但不会重定向到该链接。

其中之一是:

<a class="btn btn-link" href="{% url "layer_metadata" resource.service_typename %}">{% trans "Edit Layer Metadata" %}</a>

【问题讨论】:

  • 添加不起作用的代码
  • 嘿@c.grey 此模板中的任何锚标记都不起作用
  • 发布错误回溯和 urls.py 代码
  • 你真的希望我们阅读大约 2000 行模板代码吗?

标签: python html django django-templates anchor


【解决方案1】:

如果您尝试访问另一个页面上的锚点,则该模式看起来更像

<a class="btn btn-link" href="{% url "url-name" arg1 %}#anchor">{% trans "Edit Layer Metadata" %}</a>

【讨论】:

    猜你喜欢
    • 2020-09-20
    • 2016-03-22
    • 2016-06-06
    • 1970-01-01
    • 2013-06-12
    • 2013-12-02
    • 1970-01-01
    • 2011-04-28
    • 1970-01-01
    相关资源
    最近更新 更多