I'm currently working on a project with Django where I need to convert an HTML monthly report into a PDF. The data for the report is retrieved from a database based on the selected month. I am facing an issue in sending the selected month from the HTML page to the class responsible for creating the PDF. Can anyone help me with this?
Below is my view class:
class view_pdf_monthly_report(View):
def get(self, request, *args, **kwargs):
push = {'month':month}
pdf = render_to_pdf('home/pdf_monthly_inquiries_report.html', push)
return HttpResponse(pdf, content_type='application/pdf')
In my HTML file, how can I pass the selected month value?
<div class="text-center">
<a class="btn btn-info" href="{% url 'view_pdf_monthly_report'%}" target="_blank">View PDF</a>
</div>
Thank you!