I will need to update the option values after a selection in Django template?
For example,
<select id="state" type="text" name="state" onChange="update()">
<option value="">Select state</option>
{% for state in state %}
<option value="{{state.id}}"
{{state.name|capfirst}}
</option>
{% endfor %}
</select>
After selection of the state I want to update the city queryset according to the selected state. For example, if anyone select California as their state, I want to just give the options of the cities that are inside California state.
<select id="city" type="text" name="city">
<option value="">Select city</option>
{% for city in city %}
<option value="{{city.id}}"
{{city.name|capfirst}}
</option>
{% endfor %}
</select>
Can anyone suggest what would be the best way to approach this?