Django:按钮链接 [英] Django: button link
问题描述
我是Django的新手,试图创建一个按钮,单击该按钮可链接到我网站上的另一个页面.我尝试了一些发现的不同示例,但似乎没有一个适用于我...
I am a novice Django user trying to create a push button, which links to another page in my site when clicked. I've tried a few different examples which I've found, but none seem to be working for me...
作为一个例子,为什么这不起作用?
As an example, why is this not working?
<form method="link" action="{% url 'gui' %}">
<input type="button" value="Start">
</form>
在这里,"gui"是我在urls.py中链接到所需页面的名称.
Here, 'gui' is the name I have given to my link in urls.py to the desired page.
总体上来说,我对HTML还是相当陌生,所以可能是我的HTML错了...
I am also fairly new to HTML in general, so it may be my HTML that is wrong...
谢谢.
推荐答案
是否同时使用 form
和 button
的某些特殊原因?
Is there any particular reason you're using both a form
and a button
?
您可以使用 a
(锚标签)吗?
Can you use an a
(anchor tag)?
<a href="{% url 'appname.nameOfFunctionInViews' %}">Click here</a>
如果要使用表单
,请发布您的 urls.py
.
If you want to use a form
, please post your urls.py
.
这篇关于Django:按钮链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!