Django

Code

Ticket #1282: archive_today_new.diff

File archive_today_new.diff, 1.4 kB (added by nickefford, 10 months ago)

Improved version of original patch

  • django/views/generic/date_based.py

    old new  
    274274            c[key] = value 
    275275    return HttpResponse(t.render(c), mimetype=mimetype) 
    276276 
    277 def archive_today(request, **kwargs): 
     277def archive_today(request, month_format='%b', **kwargs): 
    278278    """ 
    279279    Generic daily archive view for today. Same as archive_day view. 
    280280    """ 
    281281    today = datetime.date.today() 
    282282    kwargs.update({ 
    283283        'year': str(today.year), 
    284         'month': today.strftime('%b').lower(), 
     284        'month': today.strftime(month_format).lower(), 
    285285        'day': str(today.day), 
     286        'month_format': month_format, 
    286287    }) 
    287288    return archive_day(request, **kwargs) 
    288289 
  • tests/urls.py

    old new  
    55    (r'^test_client/', include('modeltests.test_client.urls')), 
    66    (r'^test_client_regress/', include('regressiontests.test_client_regress.urls')), 
    77 
     8    # Generic views urls 
     9    (r'^generic_views/', include('regressiontests.generic_views.urls')), 
     10 
    811    # Always provide the auth system login and logout views 
    912    (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}), 
    1013    (r'^accounts/logout/$', 'django.contrib.auth.views.logout'),