diff --git a/paramecio/citoplasma/datetime.py b/paramecio/citoplasma/datetime.py index aed14b4..4bf2245 100644 --- a/paramecio/citoplasma/datetime.py +++ b/paramecio/citoplasma/datetime.py @@ -129,7 +129,7 @@ def checkdatetime(y, m, d, h, mi, s): except: return False -# Obtain the actual time in gmt +# Obtain the actual time in local or gmt def now(gmt=False): @@ -187,6 +187,10 @@ def format_date(timeform): 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): return timestamp+offset diff --git a/paramecio/citoplasma/mtemplates.py b/paramecio/citoplasma/mtemplates.py index eab3316..6e509b4 100644 --- a/paramecio/citoplasma/mtemplates.py +++ b/paramecio/citoplasma/mtemplates.py @@ -29,6 +29,10 @@ class ptemplate: template_context=None + # A simple method used in internal things of paramecio + + show_basic_template=True + def __init__(self, module): module=path.dirname(module) diff --git a/paramecio/cromosoma/webmodel.py b/paramecio/cromosoma/webmodel.py index 97aca4d..50f24c8 100644 --- a/paramecio/cromosoma/webmodel.py +++ b/paramecio/cromosoma/webmodel.py @@ -477,6 +477,28 @@ class WebModel: 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 diff --git a/paramecio/modules/admin/index.py b/paramecio/modules/admin/index.py index b72af0e..9b1e587 100644 --- a/paramecio/modules/admin/index.py +++ b/paramecio/modules/admin/index.py @@ -38,6 +38,10 @@ t=ptemplate(__file__) @post('/'+config.admin_folder+'//') 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!='': module+='/'+submodule @@ -101,11 +105,16 @@ def home(module='', submodule=''): except ImportError: return "No exists admin module" - - - - 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) + + content_index=new_module.admin(t) + + 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: 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)