DJango - Redirect to another apps / from a button click

Viewed 272

I've been trying to redirect my user to another apps root on a button click.

So I've two apps, 'portfolio' and 'blogs'.

'blogs' is the main app which loads first.

I've been able to navigate to 'portfolio' app from 'blogs', but how can I do it the other way around?

My Project urls.py

    path('admin/', admin.site.urls),
    path('portfolio/', include('portfolio.urls')),
    path('', include('blogs.urls')),
]
1 Answers

You can use Django URL tag.

<a href="{% url 'myapp:view-name' %}">My link</a>

Example :

<a href="{% url 'portfolio:view-name' %}">Portfolio</a>
Related