How to link a specific section in a page in Django?

How to link a specific section in a page in Django?
0

I am working on a Django project which has two views, home, and dashboard. I have a <div id="test">Hello</div> in my home page. I have a link in the dashboard, which should take me to that specific #test section on the home page. If I would have to just normally route to the home page, the link in my Django would look like: <a class="nav__link" href="{% url 'metrics:home' %}">Home</a>. However, this wouldn’t take me to that specific section. How can I achieve this functionality?

urls.py


from . import views
from django.urls import path, include

app_name = 'metrics'
urlpatterns = [
    path('', views.HomeView.as_view(), name='home'),
    path('dashboard/', views.Dashboard.as_view(), name='dashboard'),
]

Your query is incomplete you should also post the views.py file and your html pages you are referring to…Apart from that you should use canonical urls for rerouting the views as they are best when working with an complex project.