Have you validated that there is actual data in the govstaff variable within your template? Nothing is going to show up if it is an empty variable or doesn't exist in your template context.
While I'm not familiar with the package you're using, I suspect you need to add the govstaff variable to your context within the get_context_data() method in your view class. Otherwise your template has no idea what data you are trying to display.
-James
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPCf-y4TC8oXGeE0q9vPcj%3Dnx9qXJ37Ac4PcZiW6cGgGKb-LJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUUy6WAnZBJcfg5jOJ7ofdBTOT6S%2B1wV5J2iX%3D6idGUbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
How are you adding the govstaff variable in the get_contexr_data method? Can you post what you tried? You shouldn't be getting an error like that. Are you trying to do it as part of the super() call?
As far as alternatives go, ReportLab is pretty popular with Django, to the point where it is on the official docs:
https://docs.djangoproject.com/en/1.8/howto/outputting-pdf/
-James
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPCf-y5aOsWtjkuR5e72yvzf46nivRyBDB5fQQJyXUorgE-nhg%40mail.gmail.com.
You need to add the get method this:
"""
Handles GET request and returns HTTP response.
"""
context = self.get_context_data(**kwargs)
#data: dic, array, etc.
values = [1,2,3,4,5]
# add the data in the context
context["values"] = values
return self.render_to_response(context)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/afe2127d-4b05-4584-bbb8-92a3435d78ad%40googlegroups.com.
class HelloPDFView(PDFTemplateView):
query_results = Contact.objects.all()
print "DEBUG : ", query_results
template_name = 'hello.html'
def get(self,request, *args, **kwargs):
context = self.get_context_data(**kwargs)
print "DEBUG : ", self.query_results
template_name = 'hello.html'
context["query_results"] = self.query_results
return self.render_to_response(context)
Try this one it working successfully