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 054bffa6
authored
Jan 15, 2026
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: Refactor delete query handling in BaseView and comment out checkbox logic in DeTable
1 parent
0b5800c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
20 deletions
opensipkd/base/views/base_views.py
opensipkd/detable/detable.py
opensipkd/base/views/base_views.py
View file @
054bffa
...
@@ -1121,18 +1121,18 @@ class BaseView(object):
...
@@ -1121,18 +1121,18 @@ class BaseView(object):
q
=
self
.
query_id
()
q
=
self
.
query_id
()
if
self
.
allow_check
:
if
self
.
allow_check
:
rcount
=
q
.
count
()
q
=
self
.
query_delete
()
if
rcount
>
1
:
rcount
=
q
.
count
()
try
:
try
:
q
.
delete
(
synchronize_session
=
'fetch'
)
q
.
delete
(
synchronize_session
=
'fetch'
)
self
.
db_session
.
flush
()
self
.
db_session
.
flush
()
request
.
session
.
flash
(
f
"{rcount} Data berhasil dihapus."
)
request
.
session
.
flash
(
f
"{rcount} Data berhasil dihapus."
)
except
Exception
as
e
:
except
Exception
as
e
:
request
.
session
.
flash
(
request
.
session
.
flash
(
f
"Gagal menghapus data. "
f
"Gagal menghapus data. "
f
"Pastikan data tidak berelasi dengan data lain. "
f
"Pastikan data tidak berelasi dengan data lain. "
f
"Error: {str(e)}"
,
"error"
)
f
"Error: {str(e)}"
,
"error"
)
return
self
.
route_list
()
return
self
.
route_list
()
self
.
ses
[
"readonly"
]
=
True
self
.
ses
[
"readonly"
]
=
True
row
=
q
.
first
()
row
=
q
.
first
()
...
@@ -1164,12 +1164,17 @@ class BaseView(object):
...
@@ -1164,12 +1164,17 @@ class BaseView(object):
kwargs
[
"readonly"
]
=
True
kwargs
[
"readonly"
]
=
True
kwargs
[
"table"
]
=
table
kwargs
[
"table"
]
=
table
return
self
.
returned_form
(
form
,
**
kwargs
)
return
self
.
returned_form
(
form
,
**
kwargs
)
def
query_delete
(
self
):
id_
=
self
.
req
.
matchdict
[
'id'
]
if
id_
==
'all'
:
ids_
=
[
int
(
i
)
for
i
in
self
.
req
.
params
.
get
(
"ids"
)
.
split
(
","
)]
return
self
.
table
.
query
()
.
filter
(
self
.
table
.
id
.
in_
(
ids_
))
return
self
.
table
.
query_id
(
id_
)
def
query_id
(
self
,
id_
=
None
):
def
query_id
(
self
,
id_
=
None
):
id_
=
id_
or
self
.
req
.
matchdict
[
'id'
]
id_
=
id_
or
self
.
req
.
matchdict
[
'id'
]
if
id_
==
'all'
:
ids_
=
[
int
(
i
)
for
i
in
self
.
req
.
params
.
get
(
"ids"
)
.
split
(
","
)]
return
self
.
table
.
query
()
.
filter
(
self
.
table
.
id
.
in_
(
ids_
))
return
self
.
table
.
query_id
(
id_
)
return
self
.
table
.
query_id
(
id_
)
# if self.req.user:
# if self.req.user:
...
...
opensipkd/detable/detable.py
View file @
054bffa
...
@@ -225,11 +225,11 @@ class DeTable(field.Field):
...
@@ -225,11 +225,11 @@ class DeTable(field.Field):
"""
"""
header_buttons
.
insert
(
0
,
button
)
header_buttons
.
insert
(
0
,
button
)
edit_buttons
=
[]
edit_buttons
=
[]
if
allow_check
:
#
if allow_check:
button
=
f
"""
#
button = f"""
<input type="checkbox" class="{tableid}checkAll form-control"> All</input>
#
<input type="checkbox" class="{tableid}checkAll form-control"> All</input>
"""
#
"""
edit_buttons
.
append
(
button
)
#
edit_buttons.append(button)
self
.
buttons
=
"','"
.
join
(
header_buttons
)
.
replace
(
'
\n
'
,
""
)
.
\
self
.
buttons
=
"','"
.
join
(
header_buttons
)
.
replace
(
'
\n
'
,
""
)
.
\
replace
(
';'
,
';
\n
'
)
replace
(
';'
,
';
\n
'
)
...
...
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