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 d5048ee2
authored
Sep 05, 2024
by
aa.gusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
perbaikan base
1 parent
7dd0a9ed
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
12 deletions
opensipkd/base/scripts/data/groups.csv
opensipkd/base/scripts/data/routes.csv
opensipkd/base/scripts/initializedb.py
opensipkd/base/views/base_views.py
opensipkd/base/views/departemen.py
opensipkd/models/users.py
opensipkd/base/scripts/data/groups.csv
View file @
d5048ee
group_name,description
"Superuser","Superuser"
"Web Service","Webservice"
"Pindah Departemen","Pindah Departemen"
"Guest","Guest"
\ No newline at end of file
group_name,description,member_count
"Superuser","Superuser",0
"Web Service","Webservice",0
"Pindah Departemen","Pindah Departemen",0
"Guest","Guest",0
\ No newline at end of file
opensipkd/base/scripts/data/routes.csv
View file @
d5048ee
This diff is collapsed.
Click to expand it.
opensipkd/base/scripts/initializedb.py
View file @
d5048ee
...
...
@@ -254,9 +254,8 @@ def append_csv(table, filename, keys, get_file_func=get_file,
# Penambahan checking field nullable false wajib ada datanya 2024-09-05
for
c
in
columns_table
:
if
(
not
c
[
"nullable"
]
and
(
c
[
"name"
]
not
in
data
or
not
data
[
c
[
"name"
]])
and
c
[
"name"
]
!=
"id"
):
raise
Exception
(
f
"Field '{c['name']}' wajib ada {data}"
)
if
(
not
c
[
"nullable"
]
and
c
[
"name"
]
not
in
data
and
c
[
"name"
]
!=
"id"
):
raise
Exception
(
f
"Field '{c['name']}' wajib ada {c} "
)
db_session
.
add
(
row
)
db_session
.
flush
()
...
...
opensipkd/base/views/base_views.py
View file @
d5048ee
...
...
@@ -366,7 +366,7 @@ class BaseView(object):
output_file
.
write
(
data
)
output_file
.
close
()
try
:
self
.
save_upload
(
fullpath
,
delimiter
=
delimiter
,
**
args
)
self
.
save_upload
(
fullpath
,
**
args
)
except
Exception
as
e
:
self
.
req
.
session
.
flash
(
str
(
e
),
'error'
)
return
dict
(
form
=
form
.
render
(),
...
...
@@ -384,9 +384,9 @@ class BaseView(object):
def
get_file
(
self
,
filename
):
return
open
(
filename
)
def
save_upload
(
self
,
file_name
,
delimiter
=
","
,
**
args
):
def
save_upload
(
self
,
file_name
,
**
args
):
return
append_csv
(
self
.
table
,
file_name
,
self
.
upload_keys
,
get_file_func
=
self
.
get_file
,
update_exist
=
True
,
delimiter
=
delimiter
,
get_file_func
=
self
.
get_file
,
update_exist
=
True
,
**
args
)
def
before_add
(
self
):
...
...
opensipkd/base/views/departemen.py
View file @
d5048ee
...
...
@@ -29,7 +29,7 @@ def get_departemen_list():
@colander.deferred
def
departemen_widget
(
node
,
kw
):
values
=
kw
.
get
(
'departemen_list'
,
[])
return
widget
.
Select2Widget
(
values
=
values
)
return
widget
.
Select2Widget
(
values
=
values
,
placeholder
=
"Pilih Departemen"
)
def
departemen_widget_form
():
...
...
opensipkd/models/users.py
View file @
d5048ee
...
...
@@ -30,6 +30,7 @@ class GroupPermission(GroupPermissionMixin, Base):
pass
class
UserGroup
(
UserGroupMixin
,
Base
,
CommonModel
):
@classmethod
def
_get_by_user
(
cls
,
user
):
...
...
@@ -204,6 +205,7 @@ class Permission(Base, CommonModel):
class
Group
(
GroupMixin
,
Base
,
DefaultModel
):
member_count
=
Column
(
Integer
,
nullable
=
True
,
default
=
0
)
@classmethod
def
query_group_name
(
cls
,
group_name
):
return
DBSession
.
query
(
cls
)
.
filter_by
(
group_name
=
group_name
)
...
...
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