Fixes in datetime
This commit is contained in:
parent
36c3a9453d
commit
f50701aaee
5 changed files with 116 additions and 13 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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('<script language="Javascript" src="'+make_media_url_module('js/'+js, module)+'"></script>')
|
||||
|
||||
HeaderHTML.js=[]
|
||||
HeaderHTML.js_local={}
|
||||
|
||||
return "\n".join(final_js)
|
||||
|
||||
def css_home():
|
||||
|
|
@ -155,6 +169,9 @@ class HeaderHTML:
|
|||
|
||||
final_css.append('<link href="'+make_media_url_module('css/'+css, module)+'" rel="stylesheet" type="text/css"/>')
|
||||
|
||||
HeaderHTML.css=[]
|
||||
HeaderHTML.css_local={}
|
||||
|
||||
return "\n".join(final_css)
|
||||
|
||||
|
||||
|
|
@ -229,3 +246,4 @@ def show_flash_message():
|
|||
|
||||
return message
|
||||
|
||||
standard_t=ptemplate(__file__)
|
||||
|
|
|
|||
20
paramecio/citoplasma/templates/forms/dateform.phtml
Normal file
20
paramecio/citoplasma/templates/forms/dateform.phtml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
${add_js_home_local('jquery.min.js', 'admin')}
|
||||
|
||||
<input type="text" name="${form}_day" id="time_${form}_day" value="${d}" size="2" maxlength="2"/>
|
||||
<input type="text" name="${form}_month" id="time_${form}_month" value="${m}" size="2" maxlength="2"/>
|
||||
<input type="text" name="${form}_year" id="time_${form}_year" value="${y}" size="4" maxlength="4"/>
|
||||
%if yes_time==True:
|
||||
<input type="text" name="${form}_hour" id="time_${form}_hour" value="${h}" size="2" maxlength="2"/>
|
||||
<input type="text" name="${form}_minute" id="time_${form}_minute" value="${min}" size="2" maxlength="2"/>
|
||||
<input type="text" name="${form}_second" id="time_${form}_second" value="${s}" size="2" maxlength="2"/>
|
||||
<input type="hidden" name="${form}" id="time_${form}" value="" />
|
||||
% endif
|
||||
|
||||
<script language="javascript">
|
||||
$(document).submit(function () {
|
||||
|
||||
$("#time_${form}").val($("#time_${form}_year").val()+$("#time_${form}_month").val()+$("#time_${form}_day").val()+$("#time_${form}_hour").val()+$("#time_${form}_minute").val()+$("#time_${form}_second").val());
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue