Thursday, June 30, 2016

Re: pywkhtmltopdf [Was: [mezzanine-users] Re: Images in .pdf Invoice]

To answer  how do I change from function based views to class based views,

The simplest way to do that is, 


create a view file as below:

from django.views.generic import View


class ViewName(View):

    def get(self, request, *args, **kwargs):
        <copy everything you doing inside your view for GET method>

    def post(self, request, *args, **kwargs):
        <copy everything you doing inside your view for POST method>

    <similarly do for other methods (PUT, DELETE, OPTIONS etc) if needed>


update urls.py with this view :)



On Wednesday, 29 June 2016 10:51:18 UTC+5:30, Mike Dewhirst wrote:
Sorry for hijacking a thread from Mezzanine ...

On 29/06/2016 11:22 AM, Sam Kingston wrote:
> I'm not sure if this will help you or not, but I developed a replacement
> library for xhtml2pdf (though not a drop-in):
>
> https://github.com/sjkingo/pywkhtmltopdf

Thank you Sam :)

Do you have a separate users list for questions?

In case not, I'm trying to display a page produced with function-based
views. Is there a hint you can offer?

I want the "View on site" button to produce pdf.

Maybe the real question is how do I change from function based views to
class based views - which BTW I don't want to do.

Thanks

Mike


>
> On Friday, 24 June 2016 20:13:05 UTC+10, Joseph Mohan wrote:
>
>     Any other things i'm missing with regards to getting an image into
>     the .pdf invoices?
>
>     Set the url to a full path
>
>     Tried .png/.jpgÂ
>
>     Nothing...
>
>     Any ideas?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to mezzanine-use...@googlegroups.com
> <mailto:mezzanine-users+unsubscribe@googlegroups.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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/482367e1-4ebc-469c-b318-2dcabfcbc12b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment