Some of the information here may be outdated, please check the book instead

Geraldo uses ReportLab (&, optionally, PIL) to generate nice reports:

Their examples use Django:

Here is an example of how to use in Web2Py:

Model (simplified): db.define_table(customer, Field('name', length=100))

db.define_table(purchase, Field('customer', db.customer))

Controller: def purchase_report(): from reports import ReportPurchase from geraldo.generators import PDFGenerator import gluon.contenttype import StringIO

    resp = StringIO.StringIO()

    purchases = db( > 0).select(orderby=db.purchase.customer|
    report = ReportPurchase(queryset=purchases)
    report.generate_by(PDFGenerator, filename=resp)
    response.headers['Content-Type'] = gluon.contenttype.contenttype('.pdf')
    filename = "%s_Purchases.pdf" % (request.env.server_name)
    response.headers['Content-disposition'] = "attachment; filename=\"%s\"" % filename
© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.