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 8de27740
authored
Jan 20, 2025
by
aa.gusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
allow order by id
1 parent
4f3d6d34
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
12 deletions
opensipkd/base/views/base_views.py
opensipkd/detable/detable.py
opensipkd/base/views/base_views.py
View file @
8de2774
...
...
@@ -475,6 +475,14 @@ class BaseView(object):
return
{
"row"
:
row
}
def
next_edit
(
self
,
form
,
**
kwargs
):
"""Digunakan untuk memproses button post yang lainnya
Args:
form (_type_): _description_
Returns:
_type_: _description_
"""
return
self
.
route_list
(
**
kwargs
)
def
returned_form
(
self
,
form
,
table
=
None
,
**
kwargs
):
...
...
@@ -657,6 +665,13 @@ class BaseView(object):
return
self
.
route_list
(
**
kwargs
)
def
after_edit
(
self
,
row
=
None
,
**
kwargs
):
"""Digunakan untuk memproses setelah proses penyimpanan
Args:
row (objek, optional): Berupa objek row dari tabel yang disimpan.
Defaults to None.
Returns:
HTTPFound: URL yang akan ditampilkan atau procedure tampilan yang lain
"""
return
self
.
route_list
(
**
kwargs
)
def
get_captcha_url
(
self
):
...
...
@@ -719,7 +734,11 @@ class BaseView(object):
row
.
updated
=
datetime
.
now
()
row
.
update_uid
=
user
and
user
.
id
or
None
row
.
from_dict
(
values
)
for
key
,
value
in
values
.
items
():
if
hasattr
(
row
,
key
):
setattr
(
row
,
key
,
value
)
# row.from_dict(values)
# if hasattr(row, "status"):
# status = "status" in values and values["status"] or 0
# log.debug(status)
...
...
@@ -759,13 +778,20 @@ class BaseView(object):
return
self
.
route_list
(
**
kwargs
)
def
get_values
(
self
,
row
,
istime
=
False
,
null
=
False
):
d
=
row
.
to_dict
(
null
=
null
)
d
=
dict
(
row
.
__dict__
)
d
.
pop
(
'_sa_instance_state'
,
None
)
# d = row.to_dict(null=null)
# if 'tanggal' in d and d['tanggal']:
# d["tanggal"] = dmy(row.tanggal)
values
=
{}
for
f
in
d
:
if
type
(
d
[
f
])
is
str
:
d
[
f
]
=
d
[
f
]
.
strip
()
return
d
values
[
f
]
=
d
[
f
]
.
strip
()
else
:
if
d
[
f
]
!=
None
:
values
[
f
]
=
d
[
f
]
return
values
def
get_item_table
(
self
,
parent
=
None
,
**
kwargs
):
if
not
self
.
form_list
:
...
...
@@ -806,18 +832,12 @@ class BaseView(object):
resources
=
form
.
get_widget_resources
()
if
request
.
POST
:
if
'save'
in
request
.
POST
:
# log.debug("Save Edit")
# log.debug(dict(request.POST.items()))
# log.debug(request.POST)
controls
=
request
.
POST
.
items
()
log
.
debug
(
controls
)
# log.debug(dict(controls))
# log.debug(list(controls))
try
:
controls
=
form
.
validate
(
controls
)
except
ValidationFailure
as
e
:
log
.
error
(
f
"Edit Error: {str(e.error.msg)}"
)
# log.debug(f"Edit Data: {e.cstruct}")
form
.
set_appstruct
(
e
.
cstruct
)
return
self
.
returned_form
(
form
,
table
,
**
kwargs
)
...
...
opensipkd/detable/detable.py
View file @
8de2774
...
...
@@ -285,8 +285,9 @@ class DeTable(field.Field):
return result;
}"""
if
f
.
name
==
"id"
and
self
.
action
:
if
not
d
.
get
(
"orderable"
):
d
[
"orderable"
]
=
True
d
[
"width"
]
=
"30pt"
d
[
"orderable"
]
=
False
d
[
"className"
]
=
"text-center"
d
[
"visible"
]
=
True
d
[
"render"
]
=
"""
...
...
@@ -313,7 +314,8 @@ class DeTable(field.Field):
and
thousand
[
"separator"
]
or
','
decimal
=
thousand
and
"decimal"
in
thousand
and
thousand
[
"decimal"
]
or
'.'
point
=
thousand
and
"point"
in
thousand
and
thousand
[
"point"
]
or
0
point
=
thousand
and
thousand
.
get
(
"point"
,
0
)
or
0
point
=
thousand
and
thousand
.
get
(
"precision"
,
point
)
or
point
currency
=
thousand
and
"currency"
in
thousand
and
\
thousand
[
"currency"
]
or
""
if
thousand
or
isinstance
(
f
.
typ
,
colander
.
Float
)
or
\
...
...
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