Created
October 14, 2011 12:10
-
-
Save sindresorhus/1286924 to your computer and use it in GitHub Desktop.
Django - If you have 2 date-pickers in the admin form, one for start date and one for end date, this will make sure the second picker is the same month as the first. Which improves the usability of the picker.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "admin/change_form.html" %} | |
{% block extrahead %} | |
{{ block.super }} | |
<script > | |
// override openCalendar to set the date of calendar A to calendar B | |
var _openCalendar = DateTimeShortcuts.openCalendar; | |
DateTimeShortcuts.openCalendar = function(num) { | |
_openCalendar.call( this, num ); | |
var cals = DateTimeShortcuts.calendars; | |
cals[1].drawDate( cals[0].currentMonth, cals[0].currentYear ); | |
}; | |
</script> | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment