from pdf.views import PDFView class InvoicePDFView(PDFView): template_name = "payment/invoice.html" def get_context_data(self, **kwargs): kwargs.setdefault('type', "Rechnung") kwargs.setdefault('title', f'{kwargs["type"]} #{kwargs["object"].id}') return super().get_context_data(**kwargs)