Many fixes and features

This commit is contained in:
Antonio de la Rosa 2016-01-03 23:22:44 +01:00
parent 076feab6d1
commit f63765c066
7 changed files with 24 additions and 13 deletions

View file

@ -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)

View file

@ -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:

View file

@ -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)

View file

@ -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'

View file

@ -30,9 +30,7 @@ class DateForm(BaseForm):
h=int(time[3])
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

View file

@ -98,6 +98,8 @@ class WebModel:
self.valid_fields=[]
self.last_id=0
self.distinct=''
# A method where create the new fields of this model
@ -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:
@ -844,6 +846,10 @@ class PhangoField:
# Define the form, when is created forms with create_forms you can change the properties of this class
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.

View file

@ -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