标签 url 模板 django 不起作用
我尝试在我的项目中实现 url 模板标记。
我有一个按钮,允许用户保存他所看到的数据。
所以这个按钮的url是这样的:
(2)url(r'^nameviews/download/$', 'my.path.is.this.to.download' name="load"),
模板:
<a href="{% url load %}">Download</a>
显示信息的页面的url,按钮所在的位置是:
(1)(r'^nameviews/$', path.to.page),
但是当我尝试单击该按钮时(它应该出现url 2)它没有打开包含数据的文件,但给了我与主页 (1) 相同的 url,
html 验证器给我一个错误,
<a href="">
似乎它无法识别 url 标签。
有人有什么想法吗?
I trying to implement the url template tag into my project.
I have a button that allows the user to save the data he is seeing.
So the url of this button is this:
(2)url(r'^nameviews/download/
template:
<a href="{% url load %}">Download</a>
the url of the page that shows the information, and where the button is located is:
(1)(r'^nameviews/
but when I tried to click on the button (it should appear the url 2)it doesn't open the file with the data but instead gives me the same url that the main page (1)
the html validator gives me a error on the
<a href="">
It seems it doesn't recognize the url tag.
Anyone has any idea?
, 'my.path.is.this.to.download' name="load"),
template:
the url of the page that shows the information, and where the button is located is:
but when I tried to click on the button (it should appear the url 2)it doesn't open the file with the data but instead gives me the same url that the main page (1)
the html validator gives me a error on the
It seems it doesn't recognize the url tag.
Anyone has any idea?
, path.to.page),
but when I tried to click on the button (it should appear the url 2)it doesn't open the file with the data but instead gives me the same url that the main page (1)
the html validator gives me a error on the
It seems it doesn't recognize the url tag.
Anyone has any idea?
, 'my.path.is.this.to.download' name="load"),template:
the url of the page that shows the information, and where the button is located is:
but when I tried to click on the button (it should appear the url 2)it doesn't open the file with the data but instead gives me the same url that the main page (1)
the html validator gives me a error on the
It seems it doesn't recognize the url tag.
Anyone has any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了!我真的不明白发生了什么,因为我没有改变太多,但应该是一些愚蠢的错误。
对不起!
无论如何,谢谢:)
编辑
请注意网址的顺序。在 urls.py 尝试以下顺序:
如果视图相同,则 name_of_view 相等
Resolved! I didn't really understood what's happen because I didn't change much but should have been some silly mistake.
Sorry!
Thanks any way :)
EDIT
Be careful with the order of the urls. At urls.py try this order:
name_of_view is equal if the view is the same