File: ex_77_printing-related.py

package info (click to toggle)
sqlkit 0.9.5-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,184 kB
  • sloc: python: 17,477; sql: 166; makefile: 95; xml: 23; sh: 11
file content (28 lines) | stat: -rw-r--r-- 594 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""printing/related

You can also loop on related rows


"""

def prepare_context(printtool, context, template_name, sqlwidget):
    """
    substitue director's films as table objects
    """
    context['Table1'] = (sqlwidget.related.movies.records,)


lay = """
  first_name last_name
  nation
  o2m=movies - - -

"""

t = SqlMask(model.Director, layout=lay, dbproxy=db)
t.printing.add_menu_entry('Print to pdf', 'director-movies.odt', mode='pdf')
t.printing.add_menu_entry('Print to odt', 'director-movies.odt', mode='odt')
t.printing.connect('context-ready', prepare_context)
t.reload()