Hi James, Yes i have validated that there is data in the govstaff variable. when i add govstaff to context within the get_context_data() i am getting the error non-keyword arg after keyword arg. Is there are other ways to generated pdf reports on Django?
Cheers, On Thu, Apr 23, 2015 at 12:34 PM, James Schneider <jrschneide...@gmail.com> wrote: > 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 > On Apr 22, 2015 6:16 PM, "sum abiut" <suab...@gmail.com> wrote: > >> Hi, >> I am trying to generate pdf reports using django-easy-pdf >> <http://django-easy-pdf.readthedocs.org/en/latest/index.html> but some >> how i am not geting the data. >> >> >> here is what i get. i only get the header but not the data. i think i am >> missing something from class viewpdfreport that i can't seem to figure it >> ou[image: >> Inline image 1] >> >> Here is my view.py: >> >> from django.shortcuts import render >> from django.shortcuts import render_to_response >> from django.conf import settings >> from django.views.generic import TemplateView >> from eLeave.views import govoffice >> >> from eLeave.models import newleave >> >> >> from easy_pdf.views import PDFTemplateView >> >> class viewpdfreport(PDFTemplateView): >> template_name = "viewpdf.html" >> >> def get_context_data(self, **kwargs): >> return super(viewpdfreport, self).get_context_data( >> pagesize="A4", >> title="Test!", >> **kwargs >> ) >> >> >> >> >> here is my viewpdf.html >> >> <table id="t01" > >> <tr> >> <!--<th><input type="checkbox" id="test"></th>--> >> <th>First Name</th> >> <th>Last Name</th> >> <th>Position</th> >> <th>Department</th> >> <th>Month </th> >> <th>Year</th> >> <th>Total leave consume</th> >> <th> Current Leave Entitlement</th> >> <th>Holidays</th> >> <th>Weekend</th> >> <th> Leave outstanding Balance</th> >> <th>Leave current Balance</th> >> >> >> </tr> >> {%for a in govstaff%} >> <tr> >> <!--<td><a href ="#"><input type="checkbox" onClick="parent.location='#'" >> > </a> </td>--> >> <td>{{a.first_name}}</td> >> <td>{{a.last_name}}</td> >> <td>{{a.position}}</td> >> <td>{{a.department}}</td> >> <td>{{a.month}}</td> >> <td>{{a.year}}</td> >> <td>{{a.total_working_days}}</td> >> <td>{{a.leave_entitlement}}</td> >> <td>{{a.holiday}}</td> >> <td>{{a.weekend}}</td> >> <td>{{a.leave_outstanding_balance}}</td> >> <td>{{a.leave_current_balance}}</td> >> >> >> >> </tr> >> {%endfor%} >> </table> >> >> >> this function is a view from a different app(view.py) >> def govoffice(request): >> govstaff=newleave.objects.filter(department="GOV",department_head_authorization="Approved") >> return render(request,'viewpdf.html', locals()) >> >> >> Cheers, >> >> -- >> 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+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@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 >> <https://groups.google.com/d/msgid/django-users/CAPCf-y4TC8oXGeE0q9vPcj%3Dnx9qXJ37Ac4PcZiW6cGgGKb-LJw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@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/CA%2Be%2BciUUy6WAnZBJcfg5jOJ7ofdBTOT6S%2B1wV5J2iX%3D6idGUbA%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUUy6WAnZBJcfg5jOJ7ofdBTOT6S%2B1wV5J2iX%3D6idGUbA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@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-y5aOsWtjkuR5e72yvzf46nivRyBDB5fQQJyXUorgE-nhg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.