Fixes in listings
This commit is contained in:
parent
842b2526ba
commit
509a14b165
4 changed files with 15 additions and 8 deletions
|
|
@ -15,9 +15,9 @@ class SimpleList:
|
|||
|
||||
self.model=model
|
||||
|
||||
if len(self.model.forms)==0:
|
||||
#if len(self.model.forms)==0:
|
||||
|
||||
self.model.create_forms()
|
||||
#self.model.create_forms()
|
||||
|
||||
self.fields=model.fields.keys()
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
</script>
|
||||
{% endset %}
|
||||
{{ header_js_list|add_header_home() }}-->
|
||||
<%def name="select_field()">
|
||||
<%def name="select_field(field)">
|
||||
% if simplelist.search_field==field:
|
||||
selected
|
||||
selected \
|
||||
% endif
|
||||
</%def>
|
||||
<%def name="set_css_arrow(simplelist, field)">
|
||||
|
|
@ -16,11 +16,11 @@
|
|||
</%def>
|
||||
% if simplelist.yes_search:
|
||||
<div class="form">
|
||||
<form method="get" action="{{simplelist.url}}">
|
||||
<form method="get" action="${simplelist.url}">
|
||||
${lang('common','search', 'Search')}: <input type="text" name="search_text" value="${simplelist.search_text|n}">
|
||||
<select name="search_field">
|
||||
% for field in simplelist.search_fields:
|
||||
<option value="${simplelist.model.forms[field].name}" ${select_field()}>${simplelist.model.forms[field].label}</option>
|
||||
<option value="${simplelist.model.fields[field].name}" ${select_field(field)}>${simplelist.model.fields[field].label}</option>
|
||||
% endfor
|
||||
</select>
|
||||
<input type="submit" value="${lang('common', 'search', 'Search')}" />
|
||||
|
|
|
|||
|
|
@ -78,3 +78,7 @@ def csrf_token():
|
|||
|
||||
return '<input type="hidden" name="csrf_token" id="csrf_token" value="'+s['csrf_token']+'" />'
|
||||
|
||||
def request_type():
|
||||
|
||||
return request.environ['REQUEST_METHOD']
|
||||
|
||||
|
|
|
|||
|
|
@ -781,7 +781,10 @@ class WebModel:
|
|||
def create_forms(self, arr_fields=[]):
|
||||
|
||||
if len(arr_fields)==0:
|
||||
arr_fields=self.fields.keys()
|
||||
arr_fields=list(self.fields.keys())
|
||||
|
||||
if self.name_field_id in arr_fields:
|
||||
del arr_fields[arr_fields.index(self.name_field_id)]
|
||||
|
||||
#for name_field, field in self.fields.items():
|
||||
for name_field in arr_fields:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue