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 be0b4c22
authored
Jan 29, 2026
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'v5.0' of
https://github.com/cendekia-mu/base
into v5.0
2 parents
2b74d196
70d3ece6
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
12 additions
and
234 deletions
development.ini.tpl
opensipkd/base/__init__.py
opensipkd/base/alembic/10a68b1510a6_.py → opensipkd/base/alembic/versions/021a8a342d5b_init_db.py
opensipkd/base/alembic/versions/10a68b1510a6_.py
opensipkd/base/scripts/alembic/README
opensipkd/base/scripts/alembic/env.py
opensipkd/base/scripts/alembic/script.py.mako
opensipkd/base/scripts/initializedb.py
opensipkd/base/views/api_base.py
development.ini.tpl
View file @
be0b4c2
...
...
@@ -80,8 +80,6 @@ menus = login:Login
;change_unit = False
;departemen_chg_id = 3
# digunakan jika akan menggunakan form registrasi sendiri
; PROXY
...
...
opensipkd/base/__init__.py
View file @
be0b4c2
...
...
@@ -280,7 +280,7 @@ def get_config(settings):
mobile_static_path
=
os
.
path
.
join
(
mobi_path
,
'static'
,
'mobile'
)
if
not
os
.
path
.
exists
(
mobile_static_path
):
mobile_static_path
=
os
.
makedirs
(
mobile_static_path
)
os
.
makedirs
(
mobile_static_path
)
config
.
add_static_view
(
'mobi'
,
mobile_static_path
+
os
.
sep
,
cache_max_age
=
3600
)
...
...
opensipkd/base/alembic/
10a68b1510a6_
.py
→
opensipkd/base/alembic/
versions/021a8a342d5b_init_db
.py
View file @
be0b4c2
"""
empty message
"""
Init db
Revision ID:
10a68b1510a6
Revision ID:
021a8a342d5b
Revises:
Create Date: 2026-01-
19 18:41:11.619834
Create Date: 2026-01-
25 11:30:47.960798
"""
# revision identifiers, used by Alembic.
revision
=
'
10a68b1510a6
'
revision
=
'
021a8a342d5b
'
down_revision
=
None
branch_labels
=
None
depends_on
=
None
from
alembic
import
op
import
sqlalchemy
as
sa
from
sqlalchemy.dialects
import
postgresql
def
upgrade
():
# ### commands auto generated by Alembic - please adjust! ###
...
...
@@ -74,35 +74,7 @@ def upgrade():
sa
.
PrimaryKeyConstraint
(
'id'
,
name
=
op
.
f
(
'pk_departemen'
)),
schema
=
'public'
)
op
.
create_table
(
'eselon'
,
sa
.
Column
(
'pangkat'
,
sa
.
String
(
length
=
32
),
nullable
=
True
),
sa
.
Column
(
'ruang'
,
sa
.
String
(
length
=
1
),
nullable
=
True
),
sa
.
Column
(
'tunjangan'
,
sa
.
BigInteger
(),
nullable
=
True
),
sa
.
Column
(
'nama'
,
sa
.
String
(
length
=
128
),
nullable
=
False
),
sa
.
Column
(
'kode'
,
sa
.
String
(
length
=
32
),
nullable
=
False
),
sa
.
Column
(
'status'
,
sa
.
SmallInteger
(),
nullable
=
False
),
sa
.
Column
(
'created'
,
sa
.
DateTime
(),
nullable
=
True
),
sa
.
Column
(
'updated'
,
sa
.
DateTime
(),
nullable
=
True
),
sa
.
Column
(
'create_uid'
,
sa
.
Integer
(),
nullable
=
True
),
sa
.
Column
(
'update_uid'
,
sa
.
Integer
(),
nullable
=
True
),
sa
.
Column
(
'id'
,
sa
.
Integer
(),
nullable
=
False
),
sa
.
PrimaryKeyConstraint
(
'id'
,
name
=
op
.
f
(
'pk_eselon'
)),
schema
=
'public'
)
op
.
create_table
(
'pangkat'
,
sa
.
Column
(
'pangkat'
,
sa
.
String
(
length
=
32
),
nullable
=
True
),
sa
.
Column
(
'ruang'
,
sa
.
String
(
length
=
1
),
nullable
=
True
),
sa
.
Column
(
'nama'
,
sa
.
String
(
length
=
128
),
nullable
=
False
),
sa
.
Column
(
'kode'
,
sa
.
String
(
length
=
32
),
nullable
=
False
),
sa
.
Column
(
'status'
,
sa
.
SmallInteger
(),
nullable
=
False
),
sa
.
Column
(
'created'
,
sa
.
DateTime
(),
nullable
=
True
),
sa
.
Column
(
'updated'
,
sa
.
DateTime
(),
nullable
=
True
),
sa
.
Column
(
'create_uid'
,
sa
.
Integer
(),
nullable
=
True
),
sa
.
Column
(
'update_uid'
,
sa
.
Integer
(),
nullable
=
True
),
sa
.
Column
(
'id'
,
sa
.
Integer
(),
nullable
=
False
),
sa
.
PrimaryKeyConstraint
(
'id'
,
name
=
op
.
f
(
'pk_pangkat'
)),
schema
=
'public'
)
op
.
create_table
(
'permissions'
,
sa
.
Column
(
'id'
,
sa
.
Integer
(),
nullable
=
False
),
sa
.
Column
(
'perm_name'
,
sa
.
String
(
length
=
64
),
nullable
=
False
),
...
...
@@ -228,23 +200,7 @@ def upgrade():
mysql_charset
=
'utf8'
,
mysql_engine
=
'InnoDB'
)
op
.
create_table
(
'jabatan'
,
sa
.
Column
(
'jenis'
,
sa
.
SmallInteger
(),
nullable
=
True
),
sa
.
Column
(
'nama_lain'
,
sa
.
String
(
length
=
128
),
nullable
=
True
),
sa
.
Column
(
'nama_pendek'
,
sa
.
String
(
length
=
128
),
nullable
=
True
),
sa
.
Column
(
'eselon_id'
,
sa
.
SmallInteger
(),
nullable
=
True
),
sa
.
Column
(
'nama'
,
sa
.
String
(
length
=
128
),
nullable
=
False
),
sa
.
Column
(
'kode'
,
sa
.
String
(
length
=
32
),
nullable
=
False
),
sa
.
Column
(
'status'
,
sa
.
SmallInteger
(),
nullable
=
False
),
sa
.
Column
(
'created'
,
sa
.
DateTime
(),
nullable
=
True
),
sa
.
Column
(
'updated'
,
sa
.
DateTime
(),
nullable
=
True
),
sa
.
Column
(
'create_uid'
,
sa
.
Integer
(),
nullable
=
True
),
sa
.
Column
(
'update_uid'
,
sa
.
Integer
(),
nullable
=
True
),
sa
.
Column
(
'id'
,
sa
.
Integer
(),
nullable
=
False
),
sa
.
ForeignKeyConstraint
([
'eselon_id'
],
[
'public.eselon.id'
],
name
=
op
.
f
(
'fk_jabatan_eselon_id_eselon'
)),
sa
.
PrimaryKeyConstraint
(
'id'
,
name
=
op
.
f
(
'pk_jabatan'
)),
schema
=
'public'
)
op
.
create_table
(
'res_dati2'
,
sa
.
Column
(
'kategori'
,
sa
.
String
(
length
=
32
),
nullable
=
True
),
sa
.
Column
(
'ibu_kota'
,
sa
.
String
(
length
=
64
),
nullable
=
True
),
...
...
@@ -427,78 +383,12 @@ def upgrade():
sa
.
ForeignKeyConstraint
([
'partner_id'
],
[
'partner.id'
],
name
=
op
.
f
(
'fk_partner_files_partner_id_partner'
)),
sa
.
PrimaryKeyConstraint
(
'id'
,
name
=
op
.
f
(
'pk_partner_files'
))
)
op
.
create_table
(
'partner_departemen'
,
sa
.
Column
(
'partner_id'
,
sa
.
Integer
(),
nullable
=
True
),
sa
.
Column
(
'departemen_id'
,
sa
.
Integer
(),
nullable
=
True
),
sa
.
Column
(
'jabatan_id'
,
sa
.
SmallInteger
(),
nullable
=
True
),
sa
.
Column
(
'mulai'
,
sa
.
DateTime
(),
nullable
=
True
),
sa
.
Column
(
'selesai'
,
sa
.
DateTime
(),
nullable
=
True
),
sa
.
Column
(
'id'
,
sa
.
Integer
(),
nullable
=
False
),
sa
.
ForeignKeyConstraint
([
'departemen_id'
],
[
'public.departemen.id'
],
name
=
op
.
f
(
'fk_partner_departemen_departemen_id_departemen'
)),
sa
.
ForeignKeyConstraint
([
'jabatan_id'
],
[
'public.jabatan.id'
],
name
=
op
.
f
(
'fk_partner_departemen_jabatan_id_jabatan'
)),
sa
.
ForeignKeyConstraint
([
'partner_id'
],
[
'partner.id'
],
name
=
op
.
f
(
'fk_partner_departemen_partner_id_partner'
)),
sa
.
PrimaryKeyConstraint
(
'id'
,
name
=
op
.
f
(
'pk_partner_departemen'
)),
sa
.
UniqueConstraint
(
'partner_id'
,
'departemen_id'
,
'jabatan_id'
,
'mulai'
,
name
=
'partner_dept_uq'
),
schema
=
'public'
)
op
.
drop_table
(
'lkpj_comment'
)
op
.
drop_table
(
'alembic_lkpj'
)
op
.
drop_table
(
'lkpj'
)
op
.
drop_table
(
'lkpj_file'
)
# ### end Alembic commands ###
def
downgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
create_table
(
'lkpj_file'
,
sa
.
Column
(
'lkpjd_id'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'file_name'
,
sa
.
VARCHAR
(
length
=
255
),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'tahun'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'description'
,
sa
.
VARCHAR
(
length
=
255
),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'status'
,
sa
.
SMALLINT
(),
autoincrement
=
False
,
nullable
=
False
),
sa
.
Column
(
'created'
,
postgresql
.
TIMESTAMP
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'updated'
,
postgresql
.
TIMESTAMP
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'create_uid'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'update_uid'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'id'
,
sa
.
INTEGER
(),
autoincrement
=
True
,
nullable
=
False
),
sa
.
ForeignKeyConstraint
([
'lkpjd_id'
],
[
'lkpj.id'
],
name
=
'fk_lkpj_file_lkpjd_id_lkpj'
),
sa
.
PrimaryKeyConstraint
(
'id'
,
name
=
'pk_lkpj_file'
)
)
op
.
create_table
(
'lkpj'
,
sa
.
Column
(
'id'
,
sa
.
INTEGER
(),
server_default
=
sa
.
text
(
"nextval('lkpj_id_seq'::regclass)"
),
autoincrement
=
True
,
nullable
=
False
),
sa
.
Column
(
'order_id'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'departemen_id'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'typ'
,
sa
.
VARCHAR
(
length
=
16
),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'name'
,
sa
.
VARCHAR
(
length
=
255
),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'description'
,
sa
.
TEXT
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'parent_id'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'status'
,
sa
.
SMALLINT
(),
autoincrement
=
False
,
nullable
=
False
),
sa
.
Column
(
'created'
,
postgresql
.
TIMESTAMP
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'updated'
,
postgresql
.
TIMESTAMP
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'create_uid'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'update_uid'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'tahun'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
ForeignKeyConstraint
([
'parent_id'
],
[
'lkpj.id'
],
name
=
'fk_lkpj_parent_id_lkpj'
),
sa
.
PrimaryKeyConstraint
(
'id'
,
name
=
'pk_lkpj'
),
postgresql_ignore_search_path
=
False
)
op
.
create_table
(
'alembic_lkpj'
,
sa
.
Column
(
'version_num'
,
sa
.
VARCHAR
(
length
=
32
),
autoincrement
=
False
,
nullable
=
False
),
sa
.
PrimaryKeyConstraint
(
'version_num'
,
name
=
'alembic_lkpj_pkc'
)
)
op
.
create_table
(
'lkpj_comment'
,
sa
.
Column
(
'lkpjd_id'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'comment'
,
sa
.
TEXT
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'status'
,
sa
.
SMALLINT
(),
autoincrement
=
False
,
nullable
=
False
),
sa
.
Column
(
'created'
,
postgresql
.
TIMESTAMP
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'updated'
,
postgresql
.
TIMESTAMP
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'create_uid'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'update_uid'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
),
sa
.
Column
(
'id'
,
sa
.
INTEGER
(),
autoincrement
=
True
,
nullable
=
False
),
sa
.
ForeignKeyConstraint
([
'lkpjd_id'
],
[
'lkpj.id'
],
name
=
'fk_lkpj_comment_lkpjd_id_lkpj'
),
sa
.
PrimaryKeyConstraint
(
'id'
,
name
=
'pk_lkpj_comment'
)
)
op
.
drop_table
(
'partner_departemen'
,
schema
=
'public'
)
op
.
drop_table
(
'partner_files'
)
op
.
drop_table
(
'user_area'
)
op
.
drop_table
(
'partner'
)
...
...
@@ -513,7 +403,6 @@ def downgrade():
op
.
drop_index
(
op
.
f
(
'ix_resources_owner_group_id'
),
table_name
=
'resources'
)
op
.
drop_table
(
'resources'
)
op
.
drop_table
(
'res_dati2'
,
schema
=
'public'
)
op
.
drop_table
(
'jabatan'
,
schema
=
'public'
)
op
.
drop_table
(
'groups_permissions'
)
op
.
drop_table
(
'external_identities'
)
op
.
drop_table
(
'users'
)
...
...
@@ -522,8 +411,6 @@ def downgrade():
op
.
drop_table
(
'routes'
)
op
.
drop_table
(
'res_provinsi'
,
schema
=
'public'
)
op
.
drop_table
(
'permissions'
,
schema
=
'public'
)
op
.
drop_table
(
'pangkat'
,
schema
=
'public'
)
op
.
drop_table
(
'eselon'
,
schema
=
'public'
)
op
.
drop_table
(
'departemen'
,
schema
=
'public'
)
op
.
drop_table
(
'parameters'
)
op
.
drop_table
(
'logs'
)
...
...
opensipkd/base/alembic/versions/10a68b1510a6_.py
View file @
be0b4c2
...
...
@@ -11,7 +11,7 @@ from sqlalchemy.dialects import postgresql
import
sqlalchemy
as
sa
from
alembic
import
op
revision
=
'10a68b1510a6'
down_revision
=
None
down_revision
=
'021a8a342d5b'
branch_labels
=
None
depends_on
=
None
...
...
opensipkd/base/scripts/alembic/README
deleted
100644 → 0
View file @
2b74d19
Generic single-database configuration.
\ No newline at end of file
opensipkd/base/scripts/alembic/env.py
deleted
100644 → 0
View file @
2b74d19
from
logging.config
import
fileConfig
from
sqlalchemy
import
engine_from_config
from
sqlalchemy
import
pool
from
alembic
import
context
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config
=
context
.
config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
if
config
.
config_file_name
is
not
None
:
fileConfig
(
config
.
config_file_name
)
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
target_metadata
=
None
# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
def
run_migrations_offline
()
->
None
:
"""Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output.
"""
url
=
config
.
get_main_option
(
"sqlalchemy.url"
)
context
.
configure
(
url
=
url
,
target_metadata
=
target_metadata
,
literal_binds
=
True
,
dialect_opts
=
{
"paramstyle"
:
"named"
},
)
with
context
.
begin_transaction
():
context
.
run_migrations
()
def
run_migrations_online
()
->
None
:
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
"""
connectable
=
engine_from_config
(
config
.
get_section
(
config
.
config_ini_section
,
{}),
prefix
=
"sqlalchemy."
,
poolclass
=
pool
.
NullPool
,
)
with
connectable
.
connect
()
as
connection
:
context
.
configure
(
connection
=
connection
,
target_metadata
=
target_metadata
)
with
context
.
begin_transaction
():
context
.
run_migrations
()
if
context
.
is_offline_mode
():
run_migrations_offline
()
else
:
run_migrations_online
()
opensipkd/base/scripts/alembic/script.py.mako
deleted
100644 → 0
View file @
2b74d19
"""${message}
Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
# revision identifiers, used by Alembic.
revision: str = ${repr(up_revision)}
down_revision: Union[str, Sequence[str], None] = ${repr(down_revision)}
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
def upgrade() -> None:
"""Upgrade schema."""
${upgrades if upgrades else "pass"}
def downgrade() -> None:
"""Downgrade schema."""
${downgrades if downgrades else "pass"}
opensipkd/base/scripts/initializedb.py
View file @
be0b4c2
...
...
@@ -412,7 +412,7 @@ def main(argv=sys.argv):
engine
=
engine_from_config
(
settings
,
'sqlalchemy.'
)
DBSession
.
configure
(
bind
=
engine
)
LogDBSession
.
configure
(
bind
=
engine
)
Base
.
metadata
.
create_all
(
bind
=
engine
)
#
Base.metadata.create_all(bind=engine)
alembic_run
(
config_uri
,
"alembic_base"
)
# base_alembic_run(config_uri)
...
...
opensipkd/base/views/api_base.py
View file @
be0b4c2
...
...
@@ -3,7 +3,7 @@ import logging
import
colander
from
decimal
import
Decimal
from
deform
import
Form
,
ValidationFailure
from
opensipkd.
webr.models.user
s
import
User
from
opensipkd.
model
s
import
User
from
pyramid.response
import
Response
from
opensipkd.base.models
import
DBSession
from
deform.widget
import
SelectWidget
...
...
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