1👍
When you define the urls. you can chose a name to use whenever into a django template, to reffer to this url
path('shirts/',views.shirts,name='shirts'),
now, inside a template
<a href="{% url 'shirts' %}">Shirts</a>
The name after the url within the ” is the NAME you define into your urls file
0👍
you can go to parent directory by ..
so <a href='../../../shirts'>
would be what you want,
or without changing the directory <a href='/shop/shirts'>
.
but it’s better to use {% url 'url-name' %}
- [Answered ]-Change script run from commandline to django view
- [Answered ]-How to link django to my own 404 error page?
- [Answered ]-Attribute Error while importing views in Urls.py in django rest framework
- [Answered ]-Django – Database image from models
- [Answered ]-What is django request handler callback()
Source:stackexchange.com