2024-05-13 00:26:45 发布
网友
期望输出:
You're currently following xx artists
假设我在Django模板中使用了Pug,如果我不想硬编码URL(我在URL中把它命名为artists),并且艺术家计数也是一个变量,我该如何实现呢?你知道吗
artists
我可以做到:
p You're currently following #{user_artists_count} artists
但是,如何使最后一部分成为指向名为artists的Django URL的链接?你知道吗
您可以使用下面的语法在pug模板中使用{% url %}django标记。你知道吗
{% url %}
(我把它放在这里作为参考,在过去的几个小时里我一直在寻找它。)
p You're currently - url 'artists' as the_url a(href=the_url) following #{user_artists_count} artists
资料来源:https://docs.djangoproject.com/en/2.1/ref/templates/builtins/#url
您可以使用下面的语法在pug模板中使用
{% url %}
django标记。你知道吗(我把它放在这里作为参考,在过去的几个小时里我一直在寻找它。)
资料来源:https://docs.djangoproject.com/en/2.1/ref/templates/builtins/#url
相关问题 更多 >
编程相关推荐