fix problems with reportlab and ugettext_lazy
This commit is contained in:
parent
e22467b06e
commit
debaa505fb
@ -16,7 +16,7 @@ from django.core.urlresolvers import reverse
|
||||
from django.contrib import messages
|
||||
from django.db import transaction
|
||||
from django.db.models import Model
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
|
||||
from openslides.utils.pdf import stylesheet
|
||||
@ -254,7 +254,7 @@ def register_tab(request):
|
||||
"""
|
||||
register the agenda tab.
|
||||
"""
|
||||
selected = True if request.path.startswith('/agenda/') else False
|
||||
selected = request.path.startswith('/agenda/')
|
||||
return Tab(
|
||||
title=_('Agenda'),
|
||||
url=reverse('item_overview'),
|
||||
|
@ -34,7 +34,7 @@ from django.core.context_processors import csrf
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import transaction
|
||||
from django.shortcuts import redirect
|
||||
from django.utils.translation import ugettext_lazy as _, ungettext
|
||||
from django.utils.translation import ugettext as _, ungettext
|
||||
|
||||
from openslides.utils import csv_ext
|
||||
from openslides.utils.pdf import stylesheet
|
||||
@ -852,13 +852,13 @@ class ApplicationPollPDF(PDFView):
|
||||
circle = "<img src='%s' width='15' height='15'/> " % imgpath
|
||||
cell = []
|
||||
cell.append(Spacer(0,0.8*cm))
|
||||
cell.append(Paragraph(_("Application No.")+" "+str(self.poll.application.number), stylesheet['Ballot_title']))
|
||||
cell.append(Paragraph(_("Application No. %s") % self.poll.application.number, stylesheet['Ballot_title']))
|
||||
cell.append(Paragraph(self.poll.application.title, stylesheet['Ballot_subtitle']))
|
||||
cell.append(Paragraph(str(self.poll.get_ballot())+". "+_("Vote"), stylesheet['Ballot_description']))
|
||||
cell.append(Paragraph(_("%d. Vote") % self.poll.get_ballot(), stylesheet['Ballot_description']))
|
||||
cell.append(Spacer(0,0.5*cm))
|
||||
cell.append(Paragraph(circle+_("Yes"), stylesheet['Ballot_option']))
|
||||
cell.append(Paragraph(circle+_("No"), stylesheet['Ballot_option']))
|
||||
cell.append(Paragraph(circle+_("Abstention"), stylesheet['Ballot_option']))
|
||||
cell.append(Paragraph(circle + unicode(_("Yes")), stylesheet['Ballot_option']))
|
||||
cell.append(Paragraph(circle + unicode(_("No")), stylesheet['Ballot_option']))
|
||||
cell.append(Paragraph(circle + unicode(_("Abstention")), stylesheet['Ballot_option']))
|
||||
data= []
|
||||
# get ballot papers config values
|
||||
ballot_papers_selection = config["application_pdf_ballot_papers_selection"]
|
||||
|
@ -227,9 +227,10 @@ class AssignmentPoll(BasePoll, CountInvalid, CountVotesCast, PublishPollMixin):
|
||||
self.yesnoabstain = False
|
||||
self.save()
|
||||
if self.yesnoabstain:
|
||||
return [_('Yes'), _('No'), _('Abstain')]
|
||||
return [ugettext_noop('Yes'), ugettext_noop('No'),
|
||||
ugettext_noop('Abstain')]
|
||||
else:
|
||||
return [_('Votes')]
|
||||
return [ugettext_noop('Votes')]
|
||||
|
||||
def append_pollform_fields(self, fields):
|
||||
CountInvalid.append_pollform_fields(self, fields)
|
||||
|
@ -23,7 +23,7 @@ from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.models import User
|
||||
from django.shortcuts import redirect
|
||||
from django.utils.translation import ungettext, ugettext_lazy as _
|
||||
from django.utils.translation import ungettext, ugettext as _
|
||||
|
||||
from utils.pdf import stylesheet
|
||||
from utils.template import Tab
|
||||
@ -349,7 +349,7 @@ class AssignmentPDF(PDFView):
|
||||
|
||||
def get_assignment(self, assignment, story):
|
||||
# title
|
||||
story.append(Paragraph(_("Election")+": %s" % assignment.name,
|
||||
story.append(Paragraph(_("Election: %s") % assignment.name,
|
||||
stylesheet['Heading1']))
|
||||
story.append(Spacer(0, 0.5 * cm))
|
||||
# posts
|
||||
@ -380,7 +380,6 @@ class AssignmentPDF(PDFView):
|
||||
polls = assignment.poll_set.filter(published=True)
|
||||
data_votes = []
|
||||
|
||||
|
||||
# Left side
|
||||
cell3a = []
|
||||
cell3a.append(Paragraph("%s:" % (_("Vote results")),
|
||||
@ -416,10 +415,8 @@ class AssignmentPDF(PDFView):
|
||||
if vote == None:
|
||||
row.append('–')
|
||||
elif 'Yes' in vote and 'No' in vote and 'Abstain' in vote:
|
||||
tmp = _("Y")+": " + vote['Yes'] + "\n"
|
||||
tmp += _("N")+": " + vote['No'] + "\n"
|
||||
tmp += _("A")+": " + vote['Abstain']
|
||||
row.append(tmp)
|
||||
row.append(_("Y: %s\nN: %s\nA: %s") % (vote['Yes'],
|
||||
vote['No'], vote['Abstain']))
|
||||
elif 'Votes' in vote:
|
||||
row.append(vote['Votes'])
|
||||
else:
|
||||
@ -649,6 +646,6 @@ def register_tab(request):
|
||||
|
||||
def get_widgets(request):
|
||||
return [
|
||||
Widget(name=ugettext('Assignments'), template='assignment/widget.html',
|
||||
Widget(name=_('Assignments'), template='assignment/widget.html',
|
||||
context={'assignments': Assignment.objects.all()})
|
||||
]
|
||||
|
@ -32,7 +32,7 @@ from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.models import User, Group
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.shortcuts import redirect
|
||||
from django.utils.translation import ugettext_lazy as _, ungettext
|
||||
from django.utils.translation import ugettext as _, ungettext
|
||||
|
||||
from openslides.utils import csv_ext
|
||||
from openslides.utils.pdf import stylesheet
|
||||
|
@ -220,17 +220,16 @@ def firstPage(canvas, doc):
|
||||
# time
|
||||
canvas.setFont('Ubuntu', 7)
|
||||
time = datetime.now().strftime(str(_("%Y-%m-%d %H:%Mh")))
|
||||
canvas.drawString(15 * cm, 28 * cm, _("Printed") + ": %s" % time)
|
||||
canvas.drawString(15 * cm, 28 * cm, unicode(_("Printed: %s") % time))
|
||||
# title
|
||||
if doc.title:
|
||||
canvas.setFont('Ubuntu-Bold', 24)
|
||||
canvas.setFillGray(0)
|
||||
#canvas.drawCentredString(PAGE_WIDTH/2.0, PAGE_HEIGHT-108, doc.title)
|
||||
canvas.drawString(2.75 * cm, PAGE_HEIGHT - 108, doc.title)
|
||||
canvas.drawString(2.75 * cm, PAGE_HEIGHT - 108, unicode(doc.title))
|
||||
# footer (with page number)
|
||||
canvas.setFont('Ubuntu', 8)
|
||||
canvas.setFillGray(0.4)
|
||||
canvas.drawString(10 * cm, 1*cm, _("Page") + " %s" % doc.page)
|
||||
canvas.drawString(10 * cm, 1 * cm, unicode(_("Page %s") % doc.page))
|
||||
canvas.restoreState()
|
||||
|
||||
|
||||
@ -239,5 +238,5 @@ def laterPages(canvas, doc):
|
||||
# footer (with page number)
|
||||
canvas.setFont('Ubuntu', 7)
|
||||
canvas.setFillGray(0.4)
|
||||
canvas.drawString(10 * cm, 1 * cm, _("Page") + " %s" % doc.page)
|
||||
canvas.drawString(10 * cm, 1 * cm, unicode(_("Page %s") % doc.page))
|
||||
canvas.restoreState()
|
||||
|
@ -282,9 +282,6 @@ class PDFView(PermissionMixin, View):
|
||||
response.write(pdf)
|
||||
return response
|
||||
|
||||
def append_to_pdf(self, story):
|
||||
pass
|
||||
|
||||
def get_filename(self):
|
||||
return self.filename
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user