开发者

tag url template django doesn't work

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/$', 'my.path.is.this.to.download' name="load"),

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/$', 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

    <a href="">   

It seems it doesn't recognize the url tag.

Anyone has any idea?


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:

url(r'^nameviews/download/$', name_of_view, name="load"),
url(r'^nameviews/$', name_of_view, name="first page"),

name_of_view is equal if the view is the same

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜