Answer the question
In order to leave comments, you need to log in
How to properly insert Django templatetag into jquery code?
Hello.
I use bootstrap-datepicker, I want the selected dates to be unselectable, for this I pass the list of busy dates (in the correct date format) to the datesDisabled: [] option using the template tag
<script>
$(document).ready(function(){
$(function() {
$('#sandbox-container .input-daterange').datepicker({
format: "yyyy-mm-dd",
orientation: "bottom auto",
language: "ru",
datesDisabled: {{ car.get_date }},
templates: {
leftArrow: '<i class="fa fa-arrow-left"></i>',
rightArrow: '<i class="fa fa-arrow-right"></i>'
}
});
});
});
</script>
datesDisabled: [{{ car.get_date }}],
Answer the question
In order to leave comments, you need to log in
Try to create a list earlier
And then pass the list inside the function
Probably the joke is that you close the function prematurely with symbols }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question