Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
140
Merge Requests
140
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
13ea2b27
Commit
13ea2b27
authored
Mar 05, 2015
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formulator DateTimeField: ensure value is not none and render css
parent
83c5e54f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
product/Formulator/Widget.py
product/Formulator/Widget.py
+10
-1
No files found.
product/Formulator/Widget.py
View file @
13ea2b27
...
...
@@ -1464,6 +1464,7 @@ class DateTimeWidget(Widget):
ampm
=
REQUEST
.
get
(
field
.
generate_subfield_key
(
"ampm"
,
key
=
key
))
timezone
=
REQUEST
.
get
(
field
.
generate_subfield_key
(
"timezone"
,
key
=
key
))
input_order
=
self
.
getInputOrder
(
field
)
if
input_order
==
'ymd'
:
order
=
[[
'year'
,
year
,
4
,
4
],
[
'month'
,
month
,
2
,
2
],
...
...
@@ -1509,8 +1510,11 @@ class DateTimeWidget(Widget):
return
date_result
def
render_sub_field
(
self
,
field
,
key
,
name
,
value
,
size
,
maxlength
,
REQUEST
):
if
value
is
None
:
value
=
""
if
name
in
(
'hour'
,
'minute'
):
return
render_element
(
"input"
,
type
=
"text"
,
css_class
=
field
.
get_value
(
'css_class'
),
name
=
field
.
generate_subfield_key
(
name
,
key
=
key
),
value
=
value
,
size
=
size
,
maxlength
=
maxlength
)
...
...
@@ -1519,11 +1523,16 @@ class DateTimeWidget(Widget):
if
style
==
'text'
:
return
render_element
(
"input"
,
type
=
"text"
,
css_class
=
field
.
get_value
(
'css_class'
),
name
=
field
.
generate_subfield_key
(
name
,
key
=
key
),
value
=
value
,
size
=
size
,
maxlength
=
maxlength
)
if
name
==
'year'
:
items
=
self
.
create_items
(
int
(
value
)
-
5
,
int
(
value
)
+
5
,
digits
=
4
)
if
value
==
""
:
tmp
=
2000
else
:
tmp
=
int
(
value
)
items
=
self
.
create_items
(
tmp
-
5
,
tmp
+
5
,
digits
=
4
)
elif
name
==
'month'
:
items
=
self
.
create_items
(
1
,
13
,
digits
=
2
)
elif
name
==
'day'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment