The Grappelli default datepicker comes with Sunday as the first day of the week. This is really irritating! I want Monday to be the first day of the week for all my present and future models.
Is there a way to do this?
So far, the only "solution" I found involved changing the models' Media class. However, this solution does not seem to work as is with the following:
class Monkey(ImportExportActionModelAdmin):
class Media:
js = ("static/i18n/ui.datepicker-en-GB.js")
...
Where static/i18n/ui.datepicker-en-GB.js is
(function($) {
// datepicker, timepicker init
grappelli.initDateAndTimePicker = function() {
var options = {
closeText: "Done",
prevText: "Prev",
nextText: "Next",
currentText: "Today",
monthNames: [ "January","February","March","April","May","June",
"July","August","September","October","November","December" ],
monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ],
dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ],
dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ],
dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ],
weekHeader: "Wk",
dateFormat: "dd/mm/yy",
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ""
};
} )(grp.jQuery);
In any case, this solution is sub-optimal as any new model using a date would have to have the same Meta class defined.
There are indeed a few mistakes in the code above.
First, the
AdminModelshould beAs the static directory is automatically appended and the
jsvariable must be a tuple -- notice the comma.Second, the javascrpt I used was a copy-and-paste of the
static/grappelli/js/grappelli.jsone with the optionfirstDay: 1,added to theoptionsvariable. It reads like so:Thirdly, I modified all the
AdminModelsthat needed a datepicker. This is a PITA and I wish there was a better way of doing it. There might be...