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 f11fea01
authored
Aug 23, 2025
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add obj2json utility to ApiViews for consistent object serialization
1 parent
eb16a423
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
CHANGES.txt
opensipkd/base/views/api_base.py
CHANGES.txt
View file @
f11fea0
4.0.1 2025-08-23
Penambahan obj2json pada api_base
4.0.0 17-11-2024
4.0.0 17-11-2024
Penambahan Field pada tabel routes
Penambahan Field pada tabel routes
Tabel Routes berfungsi juga sebagai menu generator
Tabel Routes berfungsi juga sebagai menu generator
...
...
opensipkd/base/views/api_base.py
View file @
f11fea0
...
@@ -7,7 +7,7 @@ from opensipkd.base.models import DBSession
...
@@ -7,7 +7,7 @@ from opensipkd.base.models import DBSession
from
opensipkd.tools.pbb
import
FixSppt
from
opensipkd.tools.pbb
import
FixSppt
from
opensipkd.tools.buttons
import
btn_save
,
btn_cancel
from
opensipkd.tools.buttons
import
btn_save
,
btn_cancel
from
.
import
api_messages
from
.
import
api_messages
from
..tools
import
obj2json
class
ApiViews
:
class
ApiViews
:
...
@@ -25,6 +25,9 @@ class ApiViews:
...
@@ -25,6 +25,9 @@ class ApiViews:
self
.
form_widget
=
None
self
.
form_widget
=
None
self
.
autocomplete
=
True
self
.
autocomplete
=
True
def
obj2json
(
self
,
obj
):
return
obj2json
(
obj
)
def
get_bindings
(
self
,
row
=
None
):
def
get_bindings
(
self
,
row
=
None
):
"""Get form bindings for the specified row."""
"""Get form bindings for the specified row."""
return
{}
return
{}
...
@@ -92,6 +95,10 @@ class ApiViews:
...
@@ -92,6 +95,10 @@ class ApiViews:
return
query
return
query
def
success
(
self
,
data
=
[],
msg
=
None
):
def
success
(
self
,
data
=
[],
msg
=
None
):
if
type
(
data
)
is
not
list
:
data
=
[
data
]
for
i
,
item
in
enumerate
(
data
):
data
[
i
]
=
self
.
obj2json
(
item
)
data
=
{
"data"
:
data
}
data
=
{
"data"
:
data
}
if
msg
:
if
msg
:
data
.
update
(
msg
)
data
.
update
(
msg
)
...
...
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