【问题标题】:Add GET parameter to the url name - Django将 GET 参数添加到 url 名称 - Django
【发布时间】:2018-12-03 07:07:55
【问题描述】:

目前我可以像这样从我的 html 模板中传递 GET 参数。

<a href="display-associations/players/?association={{ association.user.username }}">View Players</a>

但是我可以通过 url 名称参数来实现吗?我想要类似的东西。

<a href="{% url 'player-registration' %}">Add Player</a>

我不知道如何将 GET 参数添加到 url-name。

【问题讨论】:

    标签: django django-urls


    【解决方案1】:
    <a href="{% url 'player-registration' %}?association={{ association.user.username }}">Add Player</a>
    

    这样使用

    编辑" 位置固定在href

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-22
      • 2022-01-25
      • 2011-08-11
      • 1970-01-01
      • 2011-02-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多