diff --git a/paramecio/citoplasma/datetime.py b/paramecio/citoplasma/datetime.py
index 29f1e0b..914463d 100644
--- a/paramecio/citoplasma/datetime.py
+++ b/paramecio/citoplasma/datetime.py
@@ -87,22 +87,28 @@ def set_timezone():
def format_timedata(time):
- year=int(time[:4])
-
- month=int(time[4:6])
-
- day=int(time[6:8])
-
- hour=int(time[8:10])
-
- minute=int(time[10:12])
-
- second=int(time[12:14])
-
+ year=0
+ month=0
+ day=0
+ hour=0
+ minute=0
+ second=0
ampm=''
try:
+
+ year=int(time[:4])
+ month=int(time[4:6])
+
+ day=int(time[6:8])
+
+ hour=int(time[8:10])
+
+ minute=int(time[10:12])
+
+ second=int(time[12:14])
+
ampm=int(time[14:16])
except:
diff --git a/paramecio/citoplasma/mtemplates.py b/paramecio/citoplasma/mtemplates.py
index 2b041dd..eab3316 100644
--- a/paramecio/citoplasma/mtemplates.py
+++ b/paramecio/citoplasma/mtemplates.py
@@ -1,5 +1,6 @@
#!/usr/bin/python
+from bottle import hook
from mako.template import Template
from mako.lookup import TemplateLookup
from paramecio.citoplasma.urls import make_url, make_media_url, make_media_url_module, add_get_parameters
@@ -17,8 +18,17 @@ env = Environment(loader=FileSystemLoader(['/path/to/templates', '/other/path'])
template = env.get_template('mytemplate.html')
"""
+#@hook('after_request')
+#def clean_tpl_cache():
+
+ #ptemplate.clean_header_cache()
+ #pass
+
+
class ptemplate:
+ template_context=None
+
def __init__(self, module):
module=path.dirname(module)
@@ -63,7 +73,8 @@ class ptemplate:
HeaderHTML.css_local={}
HeaderHTML.js_local={}
- def clean_header_cache(self):
+ @staticmethod
+ def clean_header_cache():
HeaderHTML.css=[]
HeaderHTML.js=[]
@@ -140,6 +151,9 @@ class HeaderHTML:
for js in arr_js:
final_js.append('')
+ HeaderHTML.js=[]
+ HeaderHTML.js_local={}
+
return "\n".join(final_js)
def css_home():
@@ -155,6 +169,9 @@ class HeaderHTML:
final_css.append('')
+ HeaderHTML.css=[]
+ HeaderHTML.css_local={}
+
return "\n".join(final_css)
@@ -229,3 +246,4 @@ def show_flash_message():
return message
+standard_t=ptemplate(__file__)
diff --git a/paramecio/citoplasma/templates/forms/dateform.phtml b/paramecio/citoplasma/templates/forms/dateform.phtml
new file mode 100644
index 0000000..2dfc4a1
--- /dev/null
+++ b/paramecio/citoplasma/templates/forms/dateform.phtml
@@ -0,0 +1,20 @@
+${add_js_home_local('jquery.min.js', 'admin')}
+
+
+
+
+%if yes_time==True:
+
+
+
+
+% endif
+
+
\ No newline at end of file
diff --git a/paramecio/cromosoma/extrafields/datefield.py b/paramecio/cromosoma/extrafields/datefield.py
new file mode 100644
index 0000000..4ba7289
--- /dev/null
+++ b/paramecio/cromosoma/extrafields/datefield.py
@@ -0,0 +1,20 @@
+from paramecio.cromosoma.corefields import CharField
+from paramecio.citoplasma import datetime
+
+class DateField(CharField):
+
+ def check(self, value):
+
+ value=datetime.local_to_gmt(value)
+
+ if value==False:
+
+ self.error=True
+ self.error='Date format invalid'
+ return ''
+
+ return value
+
+ def show_formatted(self, value):
+
+ return datetime.format_date(value)
\ No newline at end of file
diff --git a/paramecio/cromosoma/extraforms/dateform.py b/paramecio/cromosoma/extraforms/dateform.py
new file mode 100644
index 0000000..8bacb0c
--- /dev/null
+++ b/paramecio/cromosoma/extraforms/dateform.py
@@ -0,0 +1,39 @@
+#!/usr/bin/python3
+
+from paramecio.cromosoma.coreforms import BaseForm
+from paramecio.citoplasma.mtemplates import standard_t
+from paramecio.citoplasma.datetime import format_timedata
+
+class DateForm(BaseForm):
+
+ def __init__(self, name, value):
+
+ super().__init__(name, value)
+
+ self.yes_time=False
+
+ def form(self):
+
+ y=''
+ m=''
+ d=''
+ h=''
+ min=''
+ s=''
+
+ time=format_timedata(self.default_value)
+
+ if time==True:
+ y=int(time[0])
+ m=int(time[1])
+ d=int(time[2])
+ 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
+
\ No newline at end of file