-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
33 lines (25 loc) · 808 Bytes
/
test.py
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
29
30
31
32
33
from base import viewgenerator
from models import Patron
class PatronTableViewGenerator(viewgenerator.TableViewGenerator):
model = Patron
fields = [
viewgenerator.ViewField("name"),
viewgenerator.ViewField("phone"),
viewgenerator.ViewField("email"),
]
class PatronDetailViewGenerator(viewgenerator.EditableDetailViewGenerator):
model = Patron
fields = [
viewgenerator.ViewField("name"),
viewgenerator.ViewField("phone"),
viewgenerator.ViewField("email"),
]
patrons = [
Patron("Jane Doe", "555 555 0155", "123 Fake St"),
Patron("John Doe", "555 555 0156", "124 Fake St")
]
pvg = PatronTableViewGenerator(patrons)
# print pvg.render()
dvg = PatronDetailViewGenerator(patrons[0])
print dvg.render()
print dvg.render_form()