Pequeño tip para hacer que al seleccionar un valor de un select se cambien las opciones de otro select.
Partimos de los dos select:
<select class="form-control rounded-0" name="sanctioningprocedure" onchange="update_reasons()">
<option value="">{% trans "Select Sanctioning Procedure" %}</option>
{% for sc in box.multiple_sanctioning_procedure_group.all %}
<option value="{{ sc.pk }}">{{ sc|object_name:request.language }}</option>
{% endfor %}
</select>
<select class="form-control rounded-0" name="complaint_reason">
<option value="">{% trans "Select Reason" %}</option>
</select>
La parte de javascript:
<script>
function update_reasons(){
var group = document.getElementById("sanctioningprocedure").value;
$("#complaint_reason").empty();
option = '';
{% for r in all_reasons %}
if (group == {{ r.group.pk }}) {
option = option + '<option value="{{ r.pk }}">{{ r|object_name:request.language }}</option>';
}
{% endfor %}
$("#complaint_reason").html(option);
}
</script>
…











