Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-tools
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 1c26b39a
authored
Mar 07, 2024
by
aagusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
penambahan fungsi tools
1 parent
50e738b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
opensipkd/tools/__init__.py
opensipkd/tools/report.py
opensipkd/tools/__init__.py
View file @
1c26b39
...
...
@@ -234,6 +234,9 @@ def datetime_from_str(value):
def
dmy
(
tgl
):
"""
Conversi dari date to string
"""
return
tgl
.
strftime
(
'
%
d-
%
m-
%
Y'
)
...
...
@@ -242,6 +245,9 @@ def hms(tgl):
def
dmy_to_date
(
tgl
):
"""
Conversi dari string to tgl
"""
return
datetime
.
datetime
.
strptime
(
tgl
,
'
%
d-
%
m-
%
Y'
)
...
...
opensipkd/tools/report.py
View file @
1c26b39
...
...
@@ -7,7 +7,7 @@ from datetime import datetime
# from z3c.rml import rml2pdf
import
subprocess
import
logging
from
..tools
import
get_settings
,
get_params
from
..tools
import
get_settings
,
get_params
,
get_random_string
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -227,7 +227,9 @@ def csv_rows(query):
rows
=
rows
)
def
csv_response
(
request
,
value
,
filename
):
def
csv_response
(
request
,
value
,
filename
=
None
):
if
not
filename
:
filename
=
get_random_string
(
20
)
+
".csv"
response
=
request
.
response
response
.
content_type
=
'text/csv'
# response.content_disposition = 'attachment;filename=' + filename
...
...
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