Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit be877e2b
authored
Oct 10, 2022
by
aagusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
penambahan relationship di partner
1 parent
ea37ada0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletions
opensipkd/base/views/partner.py
opensipkd/models/partner.py
opensipkd/base/views/partner.py
View file @
be877e2
...
@@ -88,10 +88,12 @@ class ListSchema(colander.Schema):
...
@@ -88,10 +88,12 @@ class ListSchema(colander.Schema):
colander
.
Boolean
(),
colander
.
Boolean
(),
widget
=
widget
.
CheckboxWidget
(),
widget
=
widget
.
CheckboxWidget
(),
oid
=
"status"
)
oid
=
"status"
)
def
after_bind
(
self
,
schema
,
kw
):
def
after_bind
(
self
,
schema
,
kw
):
request
=
kw
.
get
(
"request"
)
request
=
kw
.
get
(
"request"
)
self
[
"idcard"
]
.
url
=
request
.
static_url
(
get_id_card_folder
(
"/"
))
self
[
"idcard"
]
.
url
=
request
.
static_url
(
get_id_card_folder
(
"/"
))
class
ViewPartner
(
BaseView
):
class
ViewPartner
(
BaseView
):
def
__init__
(
self
,
request
):
def
__init__
(
self
,
request
):
super
()
.
__init__
(
request
)
super
()
.
__init__
(
request
)
...
@@ -261,7 +263,7 @@ class ViewPartner(BaseView):
...
@@ -261,7 +263,7 @@ class ViewPartner(BaseView):
filename
=
d
[
"idcard"
]
filename
=
d
[
"idcard"
]
url
=
self
.
req
.
static_url
(
get_id_card_folder
(
"/"
))
url
=
self
.
req
.
static_url
(
get_id_card_folder
(
"/"
))
preview_url
=
"/"
.
join
(
preview_url
=
"/"
.
join
(
[
self
.
req
.
static_url
(
url
)
,
filename
])
[
url
,
filename
])
d
[
"idcard"
]
=
{
"uid"
:
filename
.
split
(
"."
)[
0
],
d
[
"idcard"
]
=
{
"uid"
:
filename
.
split
(
"."
)[
0
],
"filename"
:
filename
,
"filename"
:
filename
,
"preview_url"
:
preview_url
"preview_url"
:
preview_url
...
...
opensipkd/models/partner.py
View file @
be877e2
...
@@ -9,6 +9,7 @@ from sqlalchemy import (
...
@@ -9,6 +9,7 @@ from sqlalchemy import (
from
.common
import
NamaModel
from
.common
import
NamaModel
from
.wilayah
import
ResProvinsi
,
ResDesa
,
ResKecamatan
,
ResDati2
from
.wilayah
import
ResProvinsi
,
ResDesa
,
ResKecamatan
,
ResDati2
from
.meta
import
(
Base
)
from
.meta
import
(
Base
)
from
sqlalchemy.orm
import
relationship
,
backref
class
PartnerModel
(
NamaModel
):
class
PartnerModel
(
NamaModel
):
...
@@ -67,6 +68,14 @@ class Partner(Base, PartnerModel):
...
@@ -67,6 +68,14 @@ class Partner(Base, PartnerModel):
desa_id
=
Column
(
Integer
,
ForeignKey
(
ResDesa
.
id
))
desa_id
=
Column
(
Integer
,
ForeignKey
(
ResDesa
.
id
))
company_id
=
Column
(
Integer
)
company_id
=
Column
(
Integer
)
nip
=
Column
(
String
(
32
))
nip
=
Column
(
String
(
32
))
res_provinsi
=
relationship
(
"ResProvinsi"
,
backref
=
backref
(
'partner'
))
res_dati2
=
relationship
(
"ResDati2"
,
backref
=
backref
(
'partner'
))
res_kecamatan
=
relationship
(
"ResKecamatan"
,
backref
=
backref
(
'partner'
))
res_desa
=
relationship
(
"ResDesa"
,
backref
=
backref
(
'partner'
))
# npwp = Column(String(16))
# npwp = Column(String(16))
# npwpd = Column(String(16))
# npwpd = Column(String(16))
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment