Little fixes
This commit is contained in:
parent
4b284dce0d
commit
6770a442e2
4 changed files with 44 additions and 5 deletions
|
|
@ -129,7 +129,7 @@ def checkdatetime(y, m, d, h, mi, s):
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Obtain the actual time in gmt
|
# Obtain the actual time in local or gmt
|
||||||
|
|
||||||
def now(gmt=False):
|
def now(gmt=False):
|
||||||
|
|
||||||
|
|
@ -187,6 +187,10 @@ def format_date(timeform):
|
||||||
|
|
||||||
return format_datetime(format_date_txt, timeform, time.localtime)
|
return format_datetime(format_date_txt, timeform, time.localtime)
|
||||||
|
|
||||||
|
def format_fulldate(timeform):
|
||||||
|
|
||||||
|
return format_datetime(format_date_txt+' '+format_time_txt, timeform, time.localtime)
|
||||||
|
|
||||||
def sum_utc(timestamp, offset):
|
def sum_utc(timestamp, offset):
|
||||||
|
|
||||||
return timestamp+offset
|
return timestamp+offset
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,10 @@ class ptemplate:
|
||||||
|
|
||||||
template_context=None
|
template_context=None
|
||||||
|
|
||||||
|
# A simple method used in internal things of paramecio
|
||||||
|
|
||||||
|
show_basic_template=True
|
||||||
|
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
|
|
||||||
module=path.dirname(module)
|
module=path.dirname(module)
|
||||||
|
|
|
||||||
|
|
@ -477,6 +477,28 @@ class WebModel:
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def set_conditions(self, sql_text, values:list) -> None:
|
||||||
|
|
||||||
|
self.conditions=[sql_text, values]
|
||||||
|
|
||||||
|
def set_order(self, order:list, position:list) -> None:
|
||||||
|
|
||||||
|
order=[]
|
||||||
|
|
||||||
|
for o in enumerate(order):
|
||||||
|
|
||||||
|
order.append('order by '+order[o]+' '+position[o])
|
||||||
|
|
||||||
|
self.order=", ".join(order)
|
||||||
|
|
||||||
|
def set_limit(self, limit: tuple) -> None:
|
||||||
|
|
||||||
|
sql_limit=str(limit[0])
|
||||||
|
|
||||||
|
if len(limit)>1:
|
||||||
|
sql_limit+=', '+str(limit[1])
|
||||||
|
|
||||||
|
self.limit='limit '+sql_limit
|
||||||
|
|
||||||
# Method for create sql tables
|
# Method for create sql tables
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,10 @@ t=ptemplate(__file__)
|
||||||
@post('/'+config.admin_folder+'/<module>/<submodule>')
|
@post('/'+config.admin_folder+'/<module>/<submodule>')
|
||||||
def home(module='', submodule=''):
|
def home(module='', submodule=''):
|
||||||
|
|
||||||
|
# A simple boolean used for show or not the code of admin module in standard template
|
||||||
|
|
||||||
|
ptemplate.show_basic_template=True
|
||||||
|
|
||||||
if submodule!='':
|
if submodule!='':
|
||||||
module+='/'+submodule
|
module+='/'+submodule
|
||||||
|
|
||||||
|
|
@ -101,11 +105,16 @@ def home(module='', submodule=''):
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
||||||
return "No exists admin module"
|
return "No exists admin module"
|
||||||
|
|
||||||
|
content_index=new_module.admin(t)
|
||||||
|
|
||||||
return t.load_template('admin/content.html', title=menu[module][0], content_index=new_module.admin(t), menu=menu, lang_selected=lang_selected, arr_i18n=I18n.dict_i18n)
|
if ptemplate.show_basic_template==True:
|
||||||
|
|
||||||
|
return t.load_template('admin/content.html', title=menu[module][0], content_index=content_index, menu=menu, lang_selected=lang_selected, arr_i18n=I18n.dict_i18n)
|
||||||
|
else:
|
||||||
|
|
||||||
|
return content_index
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return t.load_template('admin/index.html', title=I18n.lang('admin', 'welcome_to_paramecio', 'Welcome to Paramecio Admin!!!'), menu=menu, lang_selected=lang_selected, arr_i18n=I18n.dict_i18n)
|
return t.load_template('admin/index.html', title=I18n.lang('admin', 'welcome_to_paramecio', 'Welcome to Paramecio Admin!!!'), menu=menu, lang_selected=lang_selected, arr_i18n=I18n.dict_i18n)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue