Is it possible to display a specific block from a template in django?

210 views Asked by At

Just like in html when you reference a section of a page with for instance<a href="#tips">Visit the Useful Tips Section</a> Would there be a way to do a similar thing in django if for instance I wanted to load my page straight to the tips section? I am extending base.html to my home page that has a tips section. Right now i have a static url <a href="some url/#tips">home</a> i want to do the exact same but with djangos dynamic url something like {% url 'home'/#tips %}

1

There are 1 answers

0
patrys On BEST ANSWER

You can just add the fragment identifier right after the URL returned by the {% url %} template tag:

<a href="{% url 'home' %}#tips">home</a>