Ticket #1061: calendar2.diff
File calendar2.diff, 5.0 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/views/main.py
212 212 'has_delete_permission': context['perms'][app_label][opts.get_delete_permission()], 213 213 'has_change_permission': context['perms'][app_label][opts.get_change_permission()], 214 214 'has_file_field': opts.has_field_type(models.FileField), 215 'has_date_field': opts.has_field_type(models.DateTimeField) or opts.has_field_type(models.TimeField) or opts.has_field_type(models.DateField), 215 216 'has_absolute_url': hasattr(model, 'get_absolute_url'), 216 217 'auto_populated_fields': auto_populated_fields, 217 218 'bound_field_sets': bound_field_sets, -
django/contrib/admin/templates/admin/change_form.html
64 64 {% auto_populated_field_script auto_populated_fields change %} 65 65 </script> 66 66 {% endif %} 67 {% if has_date_field %}{% load admincalendar %} 68 <script type="text/javascript"> 69 week_start_day = {% admin_week_start %}; 70 addEvent(window, 'load', DateTimeShortcuts.init); 71 </script> 72 {% endif %} 67 73 </div> 68 74 </form></div> 69 75 {% endblock %} -
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