Hi,
I'm not sure if this is the correct approach or not.. But i'm finding the trigger event in the DateTimeShortcut.js is not triggering changes when you click on a date. I've done something similar to the following:
admin.py
class CustomAdmin(admin.ModelAdmin):
...
class Media:
js = (
'js/moment.min.js',
'apps/core/custom_script.js',
)
apps/core/custom_script.js
(function($) {
$(function () {
$("input#id_start_date[type='text']").change(function(){
alert("element changed");
});
});
})(django.jQuery);
If I modify the DateTimeShortcut.js in django source so that `django.jQuery(DateTimeShortcuts.calendarInputs[num]).trigger("change");` is called before the focus() and after DateTimeShortcuts.calendarInputs[num].value is set it works as expected. Is there an easier/better way to do this? Do i need to create a PR with the affect lines patched?
django/contrib/admin/static/admin/js/admin/DateTimeShortcut.js
...
415: DateTimeShortcuts.calendarInputs[num].value = new Date(y, m - 1, d).strftime(format);
416: django.jQuery(DateTimeShortcuts.calendarInputs[num]).trigger("change"); // PATCH
417: DateTimeShortcuts.calendarInputs[num].focus();
Running Django==1.10.1
thanks!