Re: generating pdf report with django-easy-pdf

2015-08-22 Thread roshan.pannase


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

-- 
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/e0463734-0735-476e-83ce-90c1e28a2444%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: generating pdf report with django-easy-pdf

2015-06-09 Thread sum abiut
Thanks Jose,
i will try that out and see how it goes.

Cheers,
Sum

On Mon, Jun 1, 2015 at 9:44 AM, Jose Aguirre 
wrote:

>
> *You need to add the get method this:*
>>
>
>  def get(self, request, *args, **kwargs):
>
> """
> 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+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/afe2127d-4b05-4584-bbb8-92a3435d78ad%40googlegroups.com
> 
> .
>
> 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-y7bQJO-EQzJDbLv-Qp5-rcbMvgMcBonv1RcjvKMtbWvzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: generating pdf report with django-easy-pdf

2015-05-31 Thread Jose Aguirre


> *You need to add the get method this:*
>

 def get(self, request, *args, **kwargs):

"""
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+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/afe2127d-4b05-4584-bbb8-92a3435d78ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: generating pdf report with django-easy-pdf

2015-04-22 Thread James Schneider
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
On Apr 22, 2015 10:25 PM, "sum abiut"  wrote:

> 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  > 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"  wrote:
>>
>>> Hi,
>>> I am trying to generate pdf reports using django-easy-pdf
>>>  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
>>>
>>> 
>>> 
>>> 
>>>   First Name
>>>   Last Name
>>>   Position
>>>   Department
>>>   Month 
>>>   Year
>>>   Total leave consume
>>>Current Leave Entitlement
>>>Holidays
>>>Weekend
>>> Leave outstanding Balance
>>>Leave current Balance
>>>
>>>
>>> 
>>> {%for a in govstaff%}
>>> 
>>> 
>>> {{a.first_name}}
>>>   {{a.last_name}}
>>>   {{a.position}}
>>>   {{a.department}}
>>>   {{a.month}}
>>>   {{a.year}}
>>>   {{a.total_working_days}}
>>>   {{a.leave_entitlement}}
>>>   {{a.holiday}}
>>>   {{a.weekend}}
>>>   {{a.leave_outstanding_balance}}
>>>   {{a.leave_current_balance}}
>>>
>>>
>>>
>>>   
>>> {%endfor%}
>>> 
>>>
>>>
>>> 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.
>>>
>>  --
>> 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
>> 
>> .
>> 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 

Re: generating pdf report with django-easy-pdf

2015-04-22 Thread sum abiut
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 
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"  wrote:
>
>> Hi,
>> I am trying to generate pdf reports using django-easy-pdf
>>  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
>>
>> 
>> 
>> 
>>   First Name
>>   Last Name
>>   Position
>>   Department
>>   Month 
>>   Year
>>   Total leave consume
>>Current Leave Entitlement
>>Holidays
>>Weekend
>> Leave outstanding Balance
>>Leave current Balance
>>
>>
>> 
>> {%for a in govstaff%}
>> 
>> 
>> {{a.first_name}}
>>   {{a.last_name}}
>>   {{a.position}}
>>   {{a.department}}
>>   {{a.month}}
>>   {{a.year}}
>>   {{a.total_working_days}}
>>   {{a.leave_entitlement}}
>>   {{a.holiday}}
>>   {{a.weekend}}
>>   {{a.leave_outstanding_balance}}
>>   {{a.leave_current_balance}}
>>
>>
>>
>>   
>> {%endfor%}
>> 
>>
>>
>> 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.
>>
>  --
> 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
> 
> .
> 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.


Re: generating pdf report with django-easy-pdf

2015-04-22 Thread James Schneider
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"  wrote:

> Hi,
> I am trying to generate pdf reports using django-easy-pdf
>  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
>
> 
> 
> 
>   First Name
>   Last Name
>   Position
>   Department
>   Month 
>   Year
>   Total leave consume
>Current Leave Entitlement
>Holidays
>Weekend
> Leave outstanding Balance
>Leave current Balance
>
>
> 
> {%for a in govstaff%}
> 
> 
> {{a.first_name}}
>   {{a.last_name}}
>   {{a.position}}
>   {{a.department}}
>   {{a.month}}
>   {{a.year}}
>   {{a.total_working_days}}
>   {{a.leave_entitlement}}
>   {{a.holiday}}
>   {{a.weekend}}
>   {{a.leave_outstanding_balance}}
>   {{a.leave_current_balance}}
>
>
>
>   
> {%endfor%}
> 
>
>
> 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.
>

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


generating pdf report with django-easy-pdf

2015-04-22 Thread sum abiut
Hi,
I am trying to generate pdf reports using django-easy-pdf
 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




  First Name
  Last Name
  Position
  Department
  Month 
  Year
  Total leave consume
   Current Leave Entitlement
   Holidays
   Weekend
Leave outstanding Balance
   Leave current Balance



{%for a in govstaff%}


{{a.first_name}}
  {{a.last_name}}
  {{a.position}}
  {{a.department}}
  {{a.month}}
  {{a.year}}
  {{a.total_working_days}}
  {{a.leave_entitlement}}
  {{a.holiday}}
  {{a.weekend}}
  {{a.leave_outstanding_balance}}
  {{a.leave_current_balance}}



  
{%endfor%}



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.