I'm trying to create a select in html to list all month and the default value of the select should be equal to the month parameter from the URL
My URL :
/list-working-session/?month=7&year=2019
month and year are the parameter
in My HTML:
<select name="month" class="form-control" id="month" required>
  {% for i in months %}
    {% if i == request.GET.month %}
      <option value="{{ i }}" selected="selected">{{ i }}</option>
    {% else %}
      <option value="{{ i }}">{{ i }}</option>
    {% endif %}
  {% endfor %}
</select>
months is the context from the view with range(1,13) and i managed to list from 1 to 12 in select option but i can't get the IF condition to work so the default select value equal to the month in the URL.
Any help would be appreciate
 
     
    