fixed dropdown template - only load javascript if actually needed

django-5.0
Thomas Leichtfuß 2020-09-05 12:55:51 +02:00
parent 436b86b7a0
commit 0597a29735
1 changed files with 9 additions and 7 deletions

View File

@ -17,10 +17,12 @@
{% endif %}
</ul>
<script>
(function($) {
$('select#{{ title|slugify }}_filter_select').change(function(evt) {
window.location.href = $(this).val();
});
})(django.jQuery);
</script>
{% if choices|slice:"4:" %}
<script>
(function($) {
$('select#{{ title|slugify }}_filter_select').change(function(evt) {
window.location.href = $(this).val();
});
})(django.jQuery);
</script>
{% endif %}