Many fixes and features
This commit is contained in:
parent
076feab6d1
commit
f63765c066
7 changed files with 24 additions and 13 deletions
|
|
@ -137,7 +137,7 @@ class SimpleList:
|
|||
|
||||
if self.search_field!='' and self.search_text!='':
|
||||
self.model.conditions[0]+=' AND '+self.search_field+' LIKE %s'
|
||||
self.model.conditions[1]=['%'+self.search_text+'%']
|
||||
self.model.conditions[1].append('%'+self.search_text+'%')
|
||||
|
||||
pass
|
||||
|
||||
|
|
@ -158,6 +158,8 @@ class SimpleList:
|
|||
|
||||
self.obtain_field_search()
|
||||
|
||||
self.model.yes_reset_conditions=False
|
||||
|
||||
self.search()
|
||||
|
||||
total_elements=self.model.select_count()
|
||||
|
|
@ -178,5 +180,7 @@ class SimpleList:
|
|||
|
||||
self.begin_page=str(self.begin_page)
|
||||
|
||||
self.model.yes_reset_conditions=True
|
||||
|
||||
return self.t.load_template('utils/list.phtml', simplelist=self, list=list_items, pages=pages)
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,11 @@
|
|||
% for row in list:
|
||||
<tr class="row_list">
|
||||
% for field in simplelist.fields_showed:
|
||||
<td>${simplelist.model.fields[field].show_formatted(row[field])}</td>
|
||||
% if simplelist.model.fields[field].escape==True:
|
||||
<td>${simplelist.model.fields[field].show_formatted(row[field])}</td>
|
||||
% else:
|
||||
<td>${simplelist.model.fields[field].show_formatted(row[field])|n}</td>
|
||||
% endif
|
||||
% endfor
|
||||
|
||||
% for extra_field_func in simplelist.arr_extra_options:
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ class BooleanField(IntegerField):
|
|||
|
||||
required=False
|
||||
|
||||
self.yes=I18n.lang('common', 'yes', 'Yes')
|
||||
self.no=I18n.lang('common', 'no', 'No')
|
||||
self.yes_text=I18n.lang('common', 'yes', 'Yes')
|
||||
self.no_text=I18n.lang('common', 'no', 'No')
|
||||
|
||||
super(IntegerField, self).__init__(name, size, required)
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class SelectForm(BaseForm):
|
|||
|
||||
for k,v in self.arr_select.items():
|
||||
arr_selected[k]=arr_selected.get(k, '')
|
||||
the_form+="<option value=\""+str(k)+"\" "+arr_selected[k]+">"+v+"</option>"
|
||||
the_form+="<option value=\""+self.setform(str(k))+"\" "+arr_selected[k]+">"+v+"</option>"
|
||||
|
||||
the_form+='</select>\n'
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ class DateForm(BaseForm):
|
|||
min=int(time[4])
|
||||
s=int(time[5])
|
||||
|
||||
|
||||
|
||||
return standard_t.load_template('forms/dateform.phtml', yes_time=self.yes_time, form=self.name, y=y, m=m, d=d, h=h, min=min, s=s)
|
||||
|
||||
#def
|
||||
|
|
|
|||
|
|
@ -99,6 +99,8 @@ class WebModel:
|
|||
|
||||
self.last_id=0
|
||||
|
||||
self.distinct=''
|
||||
|
||||
# A method where create the new fields of this model
|
||||
|
||||
def create_fields(self):
|
||||
|
|
@ -310,7 +312,7 @@ class WebModel:
|
|||
self.query_error="Error: without fields to search"
|
||||
return False
|
||||
|
||||
sql= ("select "+", ".join(final_fields)+extra_sql_field+" from "+", ".join(tables_to_select)+' '+conditions[0]+' '+self.order_by+' '+self.limit).strip()
|
||||
sql= ("select "+" "+self.distinct+", ".join(final_fields)+extra_sql_field+" from "+", ".join(tables_to_select)+' '+conditions[0]+' '+self.order_by+' '+self.limit).strip()
|
||||
|
||||
self.last_query=sql
|
||||
|
||||
|
|
@ -398,7 +400,7 @@ class WebModel:
|
|||
|
||||
cursor=self.select(fields_selected, raw_query)
|
||||
|
||||
results={}
|
||||
results=OrderedDict()
|
||||
|
||||
for row in cursor:
|
||||
|
||||
|
|
@ -845,6 +847,10 @@ class PhangoField:
|
|||
|
||||
self.name_form=BaseForm
|
||||
|
||||
# Property that define if make escape in show_formatted
|
||||
|
||||
self.escape=True
|
||||
|
||||
# This method is used for describe the new field in a sql language format.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ from paramecio.citoplasma.urls import make_url, add_get_parameters
|
|||
from paramecio.citoplasma.sessions import get_session
|
||||
from bottle import get,post,response,request
|
||||
from settings import config
|
||||
from settings import config_admin
|
||||
from paramecio.citoplasma.lists import SimpleList
|
||||
from paramecio.citoplasma.generate_admin_class import GenerateAdminClass
|
||||
from paramecio.citoplasma.httputils import GetPostFiles
|
||||
|
|
@ -40,9 +41,7 @@ def home(module='', submodule=''):
|
|||
if submodule!='':
|
||||
module+='/'+submodule
|
||||
|
||||
from settings import config_admin
|
||||
|
||||
t.clean_header_cache()
|
||||
#t.clean_header_cache()
|
||||
|
||||
#check if login
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue