0

So I am at a url host/app/?username=something and the template has such:

<form action="{% url 'index' %}?username={{ username }}" method="get">
    Period:
    <select name="period">
        <option value="overall">Overall</option>
        <option value="12month">12 Months</option>
        <option value="6month">6 Months</option>
        <option value="3month">3 Months</option>
        <option value="7day">7 days</option>
    </select>
    Limit:
    <select name="limit">
        <option value="10">10</option>
        <option value="25">25</option>
        <option value="50">50</option>
    </select>
    <br>
    <br>
    <input type="submit" value="Submit">
</form>

and what I want is to be able to submit this form so that it redirects to the url: host/app/?username=something&period=something&limit=something

However, whenever I submit, it sends me to the url: host/app/?period=something&limit=something

which is ignoring the username param in the url. The answers here: Is it possible to pass query parameters via Django's {% url %} template tag? seem to suggest that all I need to do is add the ?username={{ username }} to the url but that doesn't seem to be working.

Basically I want to be able to submit the username as a param again without having to have it in the form block.

Community
  • 1
  • 1
dsapoz
  • 31
  • 3

0 Answers0