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

Allow to pass custom GET parameters. #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

toabi
Copy link
Contributor

@toabi toabi commented Jun 25, 2015

Stripping away all GET parameters is a good way to
make them usable to differentiate between the PDF
and HTML view. But sometimes the application logic
behind the view also needs some GET parameters to
function properly or needs to know that it's beeing
accessed by the printer-request.

This allows to manually pass those parameters as a
dictionary to the request_to_pdf method.

Example:

if request.GET.get('print', None) == 'pdf':
    return render_to_pdf(request, 'pass', margin=self.pdf_margin, get_data={'no_tracking': 1})
else:
    # the usual view logic which can access the custom GET data if it is being printed

Stripping away all GET parameters is a good way to
make them usable to differentiate between the PDF
and HTML view. But sometimes the application logic
behind the view also needs some GET parameters to
function properly or needs to know that it's beeing
accessed by the printer-request.

This allows to manually pass those parameters as a
dictionary to the request_to_pdf method.
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

Successfully merging this pull request may close these issues.

1 participant