On Thu, Nov 18, 2010 at 6:08 PM, Victor Hooi <victorh...@gmail.com> wrote:
> But  yeah, I'd still love if there was a separate template I could use
> to generate the PDF. It just feels very weird building up the PDF line
> by line in views.py.

the obvious answer is "write your own"; but it doesn't have to be a
full-fledged templating language capable of creating any PDF
imaginable.  just what you need.

IOW: write a simple function for each PDF format you need, with the
data as parameters, and a file-like object to write on.  if you wish,
you can make it very non-django, the data input could be any python
sequence of data objects, that way you can feed it a list of
dictionaries, or a django queryset (handy for testcases).

then your Django views can be almost as usual: get parameters from the
request, data from the database, filter and preprocess all you need,
and feed to the relevant PDF format function.

that way you get the same content/presentation separation, even if the
presentation is written in procedural python instead of descriptive
templates.

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to