Commit f078cc11 by aa.gusti

Merge branch '5.0.3' into '5.0.3-oracle'

5.0.3

See merge request !10
2 parents 6e331111 158e195c
......@@ -223,6 +223,7 @@ class ApiViews(APIView):
"""
Mengubah data menjadi list dan convert objek menjadi string
"""
_log.debug("Response to Client: %s", data)
if not isinstance(data, list):
data = [data]
for i, item in enumerate(data):
......
......@@ -57,9 +57,11 @@ log = logging.getLogger(__name__)
# }
class AddSchema(colander.Schema):
kode = colander.SchemaNode(colander.String(), title="Kode", validator=colander.Length(max=50),
kode = colander.SchemaNode(colander.String(), title="Kode",
validator=colander.Length(max=50),
search_method = "string_contains",
searchable = True,
aligned = "text-left"
)
class UploadSchema(colander.Schema):
upload = colander.SchemaNode(
......@@ -143,7 +145,7 @@ class BaseView(object):
self.list_form = None # List dam Form
self.form_list = None # Form kemudian detail list
self.global_search = False
self.form_scripts = """
$('#parent_nm').bind('typeahead:selected', function(obj, datum) {
$('#parent_id').val(datum.id);
......@@ -590,9 +592,10 @@ class BaseView(object):
if not self.columns:
columns = []
for d in list_schema():
global_search = getattr(d, "global_search", False)
global_search = hasattr(d, "global_search") \
and getattr(d, "global_search", self.global_search) or self.global_search
search_method = hasattr(d, "search_method") \
and getattr(d, "search_method") or "string_contains"
and getattr(d, "search_method", "string_contains") or "string_contains"
if hasattr(d, "field"):
if isinstance(d.field, str):
columns.append(
......@@ -825,8 +828,10 @@ class BaseView(object):
def view_view(self, **kwargs):
request = self.req
row = self.query_id().first()
qry = self.query_id()
row = qry.first()
if not row:
log.debug(str(qry.statement.compile(compile_kwargs={'literal_binds': True})))
return self.id_not_found()
self.ses["readonly"] = True
......@@ -1196,6 +1201,7 @@ class BaseView(object):
msg = f"Data yang dicari Tidak Ditemukan ID:" \
f" {self.req.matchdict['id']}."
self.req.session.flash(msg, 'error')
log.error(msg)
return self.route_list(**kwargs)
def get_values(self, row, istime=False, null=False):
......@@ -1250,6 +1256,8 @@ class BaseView(object):
is_object = kwargs.get("is_object", self.is_object)
kwargs["is_object"] = is_object
if not row:
log.debug(self.query_id().statement.compile(
compile_kwargs={'literal_binds': True}))
return self.id_not_found(**kwargs)
if self.edit_restrict(row):
......@@ -1350,6 +1358,9 @@ class BaseView(object):
is_object = kwargs.get("is_object", self.is_object)
kwargs["is_object"] = is_object
if not row:
log.debug(str(q.statement.compile(
compile_kwargs={'literal_binds': True})))
return self.id_not_found()
if not self.bindings:
self.bindings = self.get_bindings(row)
......
<html tal:define="home '';">
<html tal:define="home request.home.strip('/');">
<body>
<div class="well">
<h2>${request.app_name}</h2>
......
<html>
<html tal:define="home request.home.strip('/');">
<body>
<div class="well">
......
<!DOCTYPE html>
<html lang="en-us" tal:define="
home request.home;
home request.home.strip('/');
user_path ['user', 'user-add', 'user-edit', 'user-view', 'user-delete'];
user_area_path ['user-area', 'user-area-add', 'user-area-edit', 'user-area-view', 'user-area-delete'];
user_dep_path ['user-departemen', 'user-departemen-add', 'user-departemen-edit', 'user-departemen-view', 'user-departemen-delete'];
......
......@@ -5,13 +5,9 @@
css css|[];
js js|[];
">
<head>
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">-->
<title>${request.app_name} | ${request.company}</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
......@@ -207,8 +203,6 @@
</span>
</aside>
<!-- END NAVIGATION -->
<!-- JS -->
<script src="${home}/static/v3/js/jquery-2.1.1.min.js"></script>
<script>
......
<!DOCTYPE html>
<html lang="en" tal:define="home request.home;">
<html lang="en" tal:define="home request.home.strip('/');">
<head>
<meta charset="utf-8">
......
<!DOCTYPE html>
<html lang="en" tal:define="home request.home;">
<html lang="en" tal:define="home request.home.strip('/');">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
......
......@@ -2,7 +2,7 @@
css_class css_class|field.widget.css_class;
style style|field.widget.style;
preview_url cstruct.get('preview_url')|'';
ext str(cstruct.get('filename').split('.')[-1:][0]).lower()|[];
ext str(cstruct.get('filename').split('.')[-1:][0]).lower()|'';
fname str(cstruct.get('filename'))|'';
delete cstruct.get('delete')|'';
maxsize field.widget.size|5242880;
......@@ -10,8 +10,12 @@
video ['avi', 'mov', 'mp4']
">
${field.start_mapping()}
<div class="thumbnail" tal:condition="not ext or ext ==''">
<img id="preview-${oid}" alt="" src="${preview_url}" style="${style}"
onload="window.URL.revokeObjectURL(this.src);"></img>
</div>
<div class="thumbnail" tal:condition="ext in img or ext in video or ext=='pdf'">
<img tal:condition="ext in img" id="preview-${oid}" alt="" src="${preview_url}" style="${style}"
<img tal:condition="ext in img or ext" id="preview-${oid}" alt="" src="${preview_url}" style="${style}"
onload="window.URL.revokeObjectURL(this.src);"></img>
<video tal:condition="ext in video" style="${style}" controls src="${preview_url}" type="video/${ext}"
id="preview-${oid}">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!