Prepopulate jQuery datepicker with list of Django date objects

I have been stuck on this for a REALLY long time and I'm hoping someone can help because I really don't know that much about javascript. I'm using the multidatespickr found here: It's just an adaptation of jQuery's normal datepicker. I have a list of Django date objects that I'm pulling from my database and I want to prepopulate the datepicker with those dates.

The JS:

<script type="text/javascript">
    //instantiate the calendar
        altField: '#id_dates_available',
        minDate: 0,
        addDates: [?????????]       

And the HTML:

<div id="custom-jquery-calendar">
     <div id="main-calendar"></div>
</div><!-- custom-jquery-calendar -->

And the Python dates list:

available_dates = hmod.Listing_Date.objects.filter(

I've been wondering if I can somehow use the addDates property and loop through my listing of available_dates in the javascript and add them one by one to the calendar??

Thanks for any help someone might be able to give. Let me know if I need to include additional information!


If the JS part is found in your page it's as easy as:

addDate: {% for x in myDateList %} {{ x }} {% endfor %}

If not, you need to check if the library allows you to populate the list of dates using ajax, you'll need to create a view that returns available_dates as json.

Need Your Help

In convertible cast, casting from T to double

java generics

I want to create generic method for getting maximal value from the array. However I got stuck at the problem of conversion between T to type Math.max method uses.

How to calculate fields in an oracle apex form in sql

sql oracle oracle-xe

I,m using Oracle XE 11g with an IR report and standard form.