Welcome | Get started | Dive into Lino | Contribute | Topics | Reference | More

Printing tables

This document just tests the print to pdf function.

This page is a tested document and the following instructions are used for initialization:

>>> from lino import startup
>>> startup('lino_book.projects.noi1e.settings.demo')
>>> from lino.api.doctest import *
>>> # rt.login('robin').show('tickets.ActiveTickets')
>>> settings.SITE.appy_params.update(raiseOnError=True)
>>> test_client.force_login(rt.login('robin').user)
>>> def mytest(k):
...     url = 'http://127.0.0.1:8000/api/{0}?an=as_pdf'.format(k)
...     res = test_client.get(url, REMOTE_USER='robin')
...     assert res.status_code == 200, "Request to {} got status code {}".format(url, res.status_code)
...     result = json.loads(res.content)
...     assert result['success']
...     print(result['open_url'])
>>> mytest("tickets/ActiveTickets")
/media/cache/appypdf/127.0.0.1/tickets.ActiveTickets.pdf
>>> mytest("tickets/AllTickets")
/media/cache/appypdf/127.0.0.1/tickets.AllTickets.pdf