Ticket #1061: calendar.diff
File calendar.diff, 4.2 KB (added by , 17 years ago) |
---|
-
django/conf/global_settings.py
244 244 # http://www.djangoproject.com/documentation/templates/#now 245 245 MONTH_DAY_FORMAT = 'F j' 246 246 247 # Default number of the first day of the week, starting sunday. 248 # 0 = Sunday, 1 = Monday, 2 = Tuesday etc. 249 WEEK_START_DAY = 0 250 247 251 # Do you want to manage transactions manually? 248 252 # Hint: you really don't! 249 253 TRANSACTIONS_MANAGED = False -
django/contrib/admin/media/js/calendar.js
55 55 56 56 // Draw days-of-week header 57 57 var tableRow = quickElement('tr', tableBody); 58 for (var i = 0; i < 7; i++) { 59 quickElement('th', tableRow, CalendarNamespace.daysOfWeek[i]); 58 for (var i = week_start_day; i < week_start_day+7; i++) { 59 if (i < 7) { 60 dayIndex = i; 61 } else { 62 dayIndex = i - 7; 63 } 64 quickElement('th', tableRow, CalendarNamespace.daysOfWeek[dayIndex]); 60 65 } 61 66 62 var startingPos = new Date(year, month-1, 1 ).getDay();67 var startingPos = new Date(year, month-1, 1-week_start_day).getDay(); 63 68 var days = CalendarNamespace.getDaysInMonth(month, year); 64 69 65 70 // Draw blanks before first of month -
django/contrib/admin/media/js/admin/DateTimeShortcuts.js
13 13 clockLinkName: 'clocklink', // name of the link that is used to toggle 14 14 admin_media_prefix: '', 15 15 init: function() { 16 week_start_day = week_start_day%7; 16 17 // Deduce admin_media_prefix by looking at the <script>s in the 17 18 // current document and finding the URL of *this* module. 18 19 var scripts = document.getElementsByTagName('script'); … … 250 251 if (e.stopPropagation) e.stopPropagation(); 251 252 } 252 253 } 253 254 addEvent(window, 'load', DateTimeShortcuts.init); -
django/contrib/admin/templatetags/admincalendar.py
1 from django.template import Library 2 3 register = Library() 4 5 def admin_week_start(): 6 """ 7 Returns the integer contained in the setting WEEK_START_DAY. 8 """ 9 try: 10 from django.conf import settings 11 except ImportError: 12 return '' 13 return settings.WEEK_START_DAY 14 admin_week_start = register.simple_tag(admin_week_start) -
django/contrib/admin/templates/widget/date_time.html
1 {% load i18n %}1 {% load i18n admincalendar %} 2 2 <p class="datetime"> 3 3 {% trans "Date:" %} {{ bound_field.form_fields.0 }}<br /> 4 4 {% trans "Time:" %} {{ bound_field.form_fields.1 }} 5 5 </p> 6 7 <script type="text/javascript"> 8 week_start_day = {% admin_week_start %}; 9 addEvent(window, 'load', DateTimeShortcuts.init); 10 </script> -
docs/settings.txt
1025 1025 set to ``False``, Django will make some optimizations so as not to load the 1026 1026 internationalization machinery. 1027 1027 1028 WEEK_START_DAY 1029 -------------- 1030 1031 Default: ``0`` 1032 1033 An integer representing the first day of the week, where 0 is Sunday, 1 is 1034 Monday, 2 is Tuesday, 3 is Wednesday, 4 is Thursday, 5 is Friday and 6 is 1035 Saturday. This is used in the Django admin contrib app in DateTimeField and 1036 DateField. 1037 1028 1038 YEAR_MONTH_FORMAT 1029 1039 ----------------- 1030 1040