Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render dynamic template before creating pdf view #68

Open
MisterNox opened this issue Apr 28, 2019 · 0 comments
Open

Render dynamic template before creating pdf view #68

MisterNox opened this issue Apr 28, 2019 · 0 comments

Comments

@MisterNox
Copy link

MisterNox commented Apr 28, 2019

Cool project!
Right now I am facing the problem, that I need to render the template file including the request parameter before creating the pdf view as my template file contains some dynamic content (DTL) based on some profile attributes of the the user currently logged in.
How do I have to change the function? Right now it looks like this:

class TeamPDFView(PDFTemplateView):
    template_name = 'pdf.html'
    base_url = 'file://' + settings.STATIC_ROOT
    download_filename = 'hello.pdf'
    def get_context_data(self, **kwargs):
        return super(TeamPDFView, self).get_context_data(
            pagesize='A4',
            title='Hi there!',
            **kwargs
        )

This works, but with an empty pdf, because of the dynamic content. Thank you very much for your help.

@MisterNox MisterNox changed the title Render page before creating pdf Render dynamic template before creating pdf view Apr 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant