2👍
I don’t think the problem is Django-related, but mostly jQuery/Grappelli-related.
As far as I remember Grappelli ships with its own jQuery (Django admin does the same), and uses a namespace to avoid conflicts, so calling $.datepicker or jQuery.whatever won’t interact with Grappelli’s jQuery.
If your ui.datepicker-it.js
looks like this:
jQuery(function($){
// do something on $.datepicker ...
});
Try changing it with:
(function($){
// do something on $.datepicker ...
})(grp.jQuery);
With grp.jQuery being the jQuery package Grappelli should be using, as in Grappelli code
On a side note, it looks like you’re trying to serve a .js file using MEDIA_URL
and MEDIA_ROOT
(given the "/media/"
portion in your path), but I’m quite sure the preferred way to serve static files and assets in Django is by using STATIC_ROOT
and STATIC_URL
. Anyway, this is just about best-practices and should not prevent your code to work in any way, since you said the file is correctly loaded.