use django.utils.dates.MONTHS_3 for short month names (resolves #225)

This commit is contained in:
Stefano Brentegani 2014-07-21 09:12:27 +02:00
parent 21e46f010d
commit c477f575db

View File

@ -26,6 +26,7 @@ from django.db.models import Q
from django.http import HttpResponseRedirect, Http404, HttpResponse, HttpResponseForbidden
from django.shortcuts import render_to_response, get_object_or_404
from django.template import loader, Context, RequestContext
from django.utils.dates import MONTHS_3
from django.utils.translation import ugettext as _
from django.utils.html import escape
from django import forms
@ -978,21 +979,7 @@ def run_report(request, report):
# a second table for more complex queries
summarytable2 = defaultdict(int)
months = (
_('Jan'),
_('Feb'),
_('Mar'),
_('Apr'),
_('May'),
_('Jun'),
_('Jul'),
_('Aug'),
_('Sep'),
_('Oct'),
_('Nov'),
_('Dec'),
)
month_name = lambda m: MONTHS_3[m].title()
first_ticket = Ticket.objects.all().order_by('created')[0]
first_month = first_ticket.created.month
@ -1005,7 +992,7 @@ def run_report(request, report):
periods = []
year, month = first_year, first_month
working = True
periods.append("%s %s" % (months[month - 1], year))
periods.append("%s %s" % (month_name(month), year))
while working:
month += 1
@ -1014,7 +1001,7 @@ def run_report(request, report):
month = 1
if (year > last_year) or (month > last_month and year >= last_year):
working = False
periods.append("%s %s" % (months[month - 1], year))
periods.append("%s %s" % (month_name(month), year))
if report == 'userpriority':
title = _('User by Priority')
@ -1080,7 +1067,7 @@ def run_report(request, report):
elif report == 'usermonth':
metric1 = u'%s' % ticket.get_assigned_to
metric2 = u'%s %s' % (months[ticket.created.month - 1], ticket.created.year)
metric2 = u'%s %s' % (month_name(ticket.created.month), ticket.created.year)
elif report == 'queuepriority':
metric1 = u'%s' % ticket.queue.title
@ -1092,11 +1079,11 @@ def run_report(request, report):
elif report == 'queuemonth':
metric1 = u'%s' % ticket.queue.title
metric2 = u'%s %s' % (months[ticket.created.month - 1], ticket.created.year)
metric2 = u'%s %s' % (month_name(ticket.created.month), ticket.created.year)
elif report == 'daysuntilticketclosedbymonth':
metric1 = u'%s' % ticket.queue.title
metric2 = u'%s %s' % (months[ticket.created.month - 1], ticket.created.year)
metric2 = u'%s %s' % (month_name(ticket.created.month), ticket.created.year)
metric3 = ticket.modified - ticket.created
metric3 = metric3.days