Changeset 3056
- Timestamp:
- 06/01/06 23:26:07 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/contrib/admin/templatetags/admin_list.py
r2844 r3056 3 3 from django.contrib.admin.views.main import MAX_SHOW_ALL_ALLOWED, ALL_VAR 4 4 from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR 5 from django.contrib.admin.views.main import IS_POPUP_VAR, EMPTY_CHANGELIST_VALUE , MONTHS5 from django.contrib.admin.views.main import IS_POPUP_VAR, EMPTY_CHANGELIST_VALUE 6 6 from django.core.exceptions import ObjectDoesNotExist 7 7 from django.db import models … … 9 9 from django.utils.html import escape 10 10 from django.utils.text import capfirst 11 from django.utils.translation import get_date_formats 11 from django.utils.translation import get_date_formats, get_partial_date_formats 12 12 from django.template import Library 13 import datetime 13 14 14 15 register = Library() … … 194 195 month_lookup = cl.params.get(month_field) 195 196 day_lookup = cl.params.get(day_field) 197 year_month_format, month_day_format = get_partial_date_formats() 196 198 197 199 link = lambda d: cl.get_query_string(d, [field_generic]) 198 200 199 201 if year_lookup and month_lookup and day_lookup: 200 month_name = MONTHS[int(month_lookup)]202 day = datetime.date(int(year_lookup), int(month_lookup), int(day_lookup)) 201 203 return { 202 204 'show': True, 203 205 'back': { 204 206 'link': link({year_field: year_lookup, month_field: month_lookup}), 205 'title': "%s %s" % (month_name, year_lookup)207 'title': dateformat.format(day, year_month_format) 206 208 }, 207 'choices': [{'title': "%s %s" % (month_name, day_lookup)}]209 'choices': [{'title': dateformat.format(day, month_day_format)}] 208 210 } 209 211 elif year_lookup and month_lookup: … … 217 219 'choices': [{ 218 220 'link': link({year_field: year_lookup, month_field: month_lookup, day_field: day.day}), 219 'title': da y.strftime('%B %d')221 'title': dateformat.format(day, month_day_format) 220 222 } for day in days] 221 223 } … … 230 232 'choices': [{ 231 233 'link': link({year_field: year_lookup, month_field: month.month}), 232 'title': "%s %s" % (month.strftime('%B'), month.year)234 'title': dateformat.format(month, year_month_format) 233 235 } for month in months] 234 236 }
