| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
| |
Method to make it easier to override spawning of the wkhtmltopdf subprocess.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MEDIA_URL and STATIC_URL used to be set only in get_context_data(),
but there are apps such as staticfiles and Django Compressor where
this won't work well.
Instead, they need to be overridden at the settings level, not at the
context level. This allows template context processors to populate a
RequestContext with the right values.
In addition, MEDIA_URL and STATIC_URL are now overridden as file://
URLs, based on MEDIA_ROOT and STATIC_ROOT. This allows developers to
access these views in runserver, against their current codebase. It
also means faster access for wkhtmltopdf, since the files are stored
locally.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before, command-line arguments were class-based. Unfortunately, this
means that you cannot add new command-line arguments without
subclassing.
Instead, PDFTemplateView.cmd_options is a dictionary of all
command-line arguments. PDFTemplateView.as_view(cmd_options={...}) now
works as expected.
!!!! WARNING !!!!
cmd_options is now empty, leaving wkhtmltopdf with its default
behaviour. Explicitly add the options you want. Existing subclasses of
PDFTemplateView will now break, but a PendingDeprecationWarning will be
issued. Margins will now be wkhtmltopdf's default of 10mm.
PdfTemplateView contains a compatibility shim with the old default
values for margins and orientation.
|
|
|
|
|
|
|
|
|
| |
PDFTemplateResponse is like TemplateResponse in that it does dynamic
rendering of a template on the fly.
PDFTemplateView has a much smaller implementation, relying on
PDFTemplateResponse to do the rendering for it. It also knows about
the standard TemplateResponse when it needs to render the HTML version.
|
|
|
|
|
|
|
| |
* Now matches HttpResponse in function signature.
* Modern Django content_type/mimetype handling.
* Sanitizes and quotes filenames in Content-Disposition header.
* Tests.
|
| |
|
|
|
|
|
| |
In case you want to pass more things up to HttpResponse.
Can't pass filename down though.
|
|
|
|
|
|
|
| |
Setting 'Content-Disposition' explicitly sets the PDF as an attachment causing
browsers to download the PDF. However newer browsers, like Chrome, will
display the PDF without this header. So assume the dev wants this to be force
download if they set the filename.
|
|
|
|
|
| |
Put _tmp_files onto the object and remove them after the output has been
created.
|
|
|
|
| |
If there's no context_instance (which seems to be the common case), make a Requestcontext and use that.
|
|
|
|
|
| |
Rather than directly going to self.template_name use the get_template_names() function
(which returns self.template_name if not overridden).
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
Use a PdfResponse to deal with the headers and response type.
Make the margin_* and filename variables instance variables on the view
with sane defaults.
|