WhyNotHugo / django-renderpdf

📄 Django app to render django templates as PDF files.
https://django-renderpdf.readthedocs.io/
ISC License
67 stars 7 forks source link

too many values to unpack (expected 4) #25

Closed deepdiver63 closed 2 years ago

deepdiver63 commented 2 years ago

I tried to install version 3.0.1 with Python 3.9.7 and Django 3.2.8. - OS Windows 10. Pip install didn't work but solve the problem installing Weasyprint. Installation seems ok. I can runserver on my local environment (development). Defined URL, VIEW and Template. Trying to obtain a PDF from file (tested with only one record selected or with all 21 records) but I receive the following msg: too many values to unpack (expected 4). Could you help? Thanks in advance url.py path('airportcode/pdf/', AirportcodePDFView.as_view(), name='airportcode_pdf'),

view.py from django_renderpdf.views import PDFView

class AirportcodePDFView(LoginRequiredMixin, PermissionRequiredMixin, PDFView): permission_required = 'masterdat.view_airportcode'

template_name = 'masterdat/airportcode_pdf.html'
prompt_download = True
download_name = 'test.pdf' 

def get_context_data(self, *args, **kwargs):
    context = super().get_context_data(*args, **kwargs)

    context['Airports'] = Airportcode.objects.filter(por_code='LSZA')
    print(context)
    return context
WhyNotHugo commented 2 years ago

Can you provide the full traceback for the exception?

deepdiver63 commented 2 years ago

Good Morning Hugo. Unfortunately not anymore. I tried to make it run during all afternoon yesterday without success. I spent a lot of hours... but as I had to provide absolutely a PDF report for this morning I decided to uninstall everything and to use the standard solution promoted in Django's doc (ReportLab). Sorry for disturb.