Automated merge with ssh://openslides.org/openslides

This commit is contained in:
Emanuel Schuetze 2012-04-14 10:54:31 +02:00
commit a4db8a49dd
4 changed files with 11 additions and 4 deletions

View File

@ -11,7 +11,7 @@
""" """
from django.conf.urls.defaults import * from django.conf.urls.defaults import *
from agenda.views import Overview, View, SetActive, SetClosed, ItemUpdate, ItemCreate, ItemDelete, ItemPDF from agenda.views import Overview, View, SetActive, SetClosed, ItemUpdate, ItemCreate, ItemDelete, AgendaPDF
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^$', url(r'^$',
@ -64,7 +64,7 @@ urlpatterns = patterns('',
), ),
url(r'^print/$', url(r'^print/$',
ItemPDF.as_view(), AgendaPDF.as_view(),
name='print_agenda', name='print_agenda',
), ),
) )

View File

@ -185,9 +185,10 @@ class ItemDelete(DeleteView):
self.gen_confirm_form(request, _('Do you really want to delete <b>%s</b>?') % name, object.get_absolute_url('delete'), True) self.gen_confirm_form(request, _('Do you really want to delete <b>%s</b>?') % name, object.get_absolute_url('delete'), True)
class ItemPDF(PDFView): class AgendaPDF(PDFView):
permission_required = 'agenda.can_see_agenda' permission_required = 'agenda.can_see_agenda'
filename = _('Agenda') filename = _('Agenda')
document_title = _('Agenda')
def append_to_pdf(self, story): def append_to_pdf(self, story):
for item in Item.objects.all(): for item in Item.objects.all():

View File

@ -608,6 +608,7 @@ class ApplicationPDF(PDFView):
permission_required = 'application.can_manage_application' permission_required = 'application.can_manage_application'
filename = u'filename=%s.pdf;' % _("Applications") filename = u'filename=%s.pdf;' % _("Applications")
top_space = 0 top_space = 0
document_title = ''
def append_to_pdf(self, story): def append_to_pdf(self, story):
try: try:

View File

@ -203,12 +203,16 @@ class DeleteView(RedirectView, SingleObjectMixin):
class PDFView(PermissionMixin, View): class PDFView(PermissionMixin, View):
filename = 'No_Name' filename = _('No name')
top_space = 3 top_space = 3
document_title = _('No title')
def get_top_space(self): def get_top_space(self):
return self.top_space return self.top_space
def get_document_title(self):
return self.document_title
def render_to_response(self, filename): def render_to_response(self, filename):
response = HttpResponse(mimetype='application/pdf') response = HttpResponse(mimetype='application/pdf')
filename = u'filename=%s.pdf;' % filename filename = u'filename=%s.pdf;' % filename
@ -216,6 +220,7 @@ class PDFView(PermissionMixin, View):
buffer = StringIO() buffer = StringIO()
pdf_document = SimpleDocTemplate(buffer) pdf_document = SimpleDocTemplate(buffer)
pdf_document.title = self.get_document_title()
story = [Spacer(1, self.get_top_space()*cm)] story = [Spacer(1, self.get_top_space()*cm)]
self.append_to_pdf(story) self.append_to_pdf(story)