partner_base.py
3.68 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import colander
from deform import FileData, widget
from opensipkd.base.views.dati2 import dati2_widget
from opensipkd.base.views.desa import desa_widget
from opensipkd.base.views.kecamatan import kecamatan_widget
from opensipkd.base.views.provinsi import provinsi_widget
from opensipkd.tools import mem_tmp_store
class NamaSchema(colander.Schema):
kode = colander.SchemaNode(
colander.String(),
validator=colander.Length(max=32),
oid="kode",
title="Kode",
width="100pt")
nama = colander.SchemaNode(
colander.String(),
validator=colander.Length(max=64),
oid="nama")
class PartnerSchema(NamaSchema):
idcard = colander.SchemaNode(
FileData(),
widget=widget.FileUploadWidget(mem_tmp_store),
missing=colander.drop,
title="ID Card"
)
alamat_1 = colander.SchemaNode(
colander.String(),
missing=colander.drop,
validator=colander.Length(max=128),
oid="alamat_1")
alamat_2 = colander.SchemaNode(
colander.String(),
missing=colander.drop,
validator=colander.Length(max=128),
oid="alamat_2")
# kelurahan = colander.SchemaNode(
# colander.String(),
# missing=colander.drop,
# validator=colander.Length(max=64),
# oid="kelurahan")
# kecamatan = colander.SchemaNode(
# colander.String(),
# missing=colander.drop,
# validator=colander.Length(max=64),
# oid="kecamatan")
# kota = colander.SchemaNode(
# colander.String(),
# validator=colander.Length(max=64),
# missing=colander.drop,
# oid="kota")
# provinsi = colander.SchemaNode(
# colander.String(),
# validator=colander.Length(max=64),
# missing=colander.drop,
# oid="provinsi")
provinsi_id = colander.SchemaNode(
colander.Integer(),
widget=provinsi_widget,
missing=colander.drop,
oid="provinsi_id",
slave="dati2_id",
slave_url="/dati2/select/act?provinsi_id=",
title="Provinsi",
)
dati2_id = colander.SchemaNode(
colander.Integer(),
widget=dati2_widget,
missing=colander.drop,
slave="kecamatan_id",
slave_url="/kecamatan/select/act?dati2_id=",
title="Kab/Kota",
oid="dati2_id")
kecamatan_id = colander.SchemaNode(
colander.Integer(),
missing=colander.drop,
widget=kecamatan_widget,
slave="desa_id",
slave_url="/desa/select/act?kecamatan_id=",
title="Kecamatan",
oid="kecamatan_id")
desa_id = colander.SchemaNode(
colander.Integer(),
widget=desa_widget,
missing=colander.drop,
title="Desa/Kelurahan",
oid="desa_id")
email = colander.SchemaNode(
colander.String(),
validator=colander.Length(max=128),
oid="email")
phone = colander.SchemaNode(
colander.String(),
validator=colander.Length(max=16),
missing=colander.drop,
oid="phone")
fax = colander.SchemaNode(
colander.String(),
validator=colander.Length(max=16),
missing=colander.drop,
oid="fax")
mobile = colander.SchemaNode(
colander.String(),
validator=colander.Length(max=16),
missing=colander.drop,
oid="mobile")
website = colander.SchemaNode(
colander.String(),
validator=colander.Length(max=128),
missing=colander.drop,
oid="website")
status = colander.SchemaNode(
colander.Boolean(),
oid="status")