Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a button-click redirect to another URL, in Django?

Tags:

html

django

I made an HTML-button, in the code shown below:

<div style="" class="button-box" >

    <button>Useradministration</button>

</div>

When I click on it, I want it to redirect the user to the /admin-url.

How should I do this? How do I make Django "know" that the button has been clicked?

Thank you so much for your time!

like image 677
Nora Avatar asked Oct 04 '17 12:10

Nora


3 Answers

you can use like this:

<a class="btn btn-primary" href="/admin-url">Useradministration</a>
like image 171
vamsi Avatar answered Oct 12 '22 23:10

vamsi


For button Click Navigation to another URL in Django

<button onclick="location.href = '/pageurl'">Click</button>
like image 20
Aravinda krishnan Avatar answered Oct 12 '22 22:10

Aravinda krishnan


For a button-click redirect to another URL in Django :

<button><a href="/admin">Click</a></button>


Another way :

<button onclick="window.location='projects';">Projects</button>
like image 43
sauravjoshi23 Avatar answered Oct 13 '22 00:10

sauravjoshi23