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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to