aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf/views.py
Commit message (Collapse)AuthorAgeFilesLines
* PDFTemplateResponse.convert_to_pdf() calls wkhtmltopdf.Simon Law2012-07-251-5/+18
| | | | Method to make it easier to override spawning of the wkhtmltopdf subprocess.
* MEDIA_URL and STATIC_URL overrides PDFTemplateResponse.get_override_settings()Simon Law2012-07-251-17/+46
| | | | | | | | | | | | | | | | 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.
* Cleanups and documentation.Simon Law2012-07-241-3/+10
|
* PDFTemplateView actually renders headers and footers now.Simon Law2012-07-241-1/+4
|
* PDFTemplateView.cmd_options contains all the options to pass to wkhtmltopdfSimon Law2012-07-241-15/+45
| | | | | | | | | | | | | | | | | | | | 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 and PDFTemplateView now match Django's implementationsSimon Law2012-07-241-35/+139
| | | | | | | | | 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.
* PDFResponse is more robust:Simon Law2012-07-231-5/+11
| | | | | | | * Now matches HttpResponse in function signature. * Modern Django content_type/mimetype handling. * Sanitizes and quotes filenames in Content-Disposition header. * Tests.
* Use warnings.warn instead of raising PendingDeprecationWarnings.Simon Law2012-07-201-6/+7
|
* Pass around args and kwargs in PDFResponseGeorge Hickman2012-05-211-5/+6
| | | | | In case you want to pass more things up to HttpResponse. Can't pass filename down though.
* Only set 'Content-Disposition' header if filename is setGeorge Hickman2012-05-211-2/+4
| | | | | | | 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.
* Don't remove tmp files before they're used.George Hickman2012-05-211-6/+12
| | | | | Put _tmp_files onto the object and remove them after the output has been created.
* Fixed remote images in pdfJames Turnbull2012-03-091-2/+6
| | | | If there's no context_instance (which seems to be the common case), make a Requestcontext and use that.
* Use get_template_names() to get templatesJames Turnbull2012-03-091-1/+1
| | | | | Rather than directly going to self.template_name use the get_template_names() function (which returns self.template_name if not overridden).
* Restore *args to PDFTemplateView.Charlie Denton2012-02-241-4/+2
|
* Fix a couple of daft mistakes.Charlie Denton2012-02-241-6/+7
|
* Add get_filename method.Charlie Denton2012-02-231-1/+4
|
* Made PDFTemplateView a little more extensible, and added orientation.Charlie Denton2012-02-231-12/+18
|
* Return super when called.Charlie Denton2012-02-231-1/+1
|
* Make PDFTemplateView use PDFResponse.Charlie Denton2012-02-231-1/+1
|
* Deprecate baDly cApitalised Views.Charlie Denton2012-02-231-2/+16
|
* Fix use of STATIC vs MEDIA urlGeorge Hickman2011-10-301-1/+1
|
* Refactor the main render method into a class based viewGeorge Hickman2011-10-301-0/+61
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.