[Django]-How to use a button to point to an existing url

2👍

You can make use of the {% url … %} template tag [Django-doc]:

<li>
    <a href="{% url 'detail' question_id=question.pk">
        {{ question.question_text }}</a></li>
        <button type='submit'> Result
        </button>
    </a>
</li>

0👍

<li><a href="/polls/{{ question.question_id }}/">{{ question.question_text }}</a></li><a href="/polls/{{ question.question_id }}/results/" title="{{ question }} Results"><button type='submit'> Result</button></a>
👤Tech

Leave a comment