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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xavier Thompson
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
Hide 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):
...
@@ -1464,6 +1464,7 @@ class DateTimeWidget(Widget):
ampm
=
REQUEST
.
get
(
field
.
generate_subfield_key
(
"ampm"
,
key
=
key
))
ampm
=
REQUEST
.
get
(
field
.
generate_subfield_key
(
"ampm"
,
key
=
key
))
timezone
=
REQUEST
.
get
(
field
.
generate_subfield_key
(
"timezone"
,
key
=
key
))
timezone
=
REQUEST
.
get
(
field
.
generate_subfield_key
(
"timezone"
,
key
=
key
))
input_order
=
self
.
getInputOrder
(
field
)
input_order
=
self
.
getInputOrder
(
field
)
if
input_order
==
'ymd'
:
if
input_order
==
'ymd'
:
order
=
[[
'year'
,
year
,
4
,
4
],
order
=
[[
'year'
,
year
,
4
,
4
],
[
'month'
,
month
,
2
,
2
],
[
'month'
,
month
,
2
,
2
],
...
@@ -1509,8 +1510,11 @@ class DateTimeWidget(Widget):
...
@@ -1509,8 +1510,11 @@ class DateTimeWidget(Widget):
return
date_result
return
date_result
def
render_sub_field
(
self
,
field
,
key
,
name
,
value
,
size
,
maxlength
,
REQUEST
):
def
render_sub_field
(
self
,
field
,
key
,
name
,
value
,
size
,
maxlength
,
REQUEST
):
if
value
is
None
:
value
=
""
if
name
in
(
'hour'
,
'minute'
):
if
name
in
(
'hour'
,
'minute'
):
return
render_element
(
"input"
,
type
=
"text"
,
return
render_element
(
"input"
,
type
=
"text"
,
css_class
=
field
.
get_value
(
'css_class'
),
name
=
field
.
generate_subfield_key
(
name
,
key
=
key
),
name
=
field
.
generate_subfield_key
(
name
,
key
=
key
),
value
=
value
,
size
=
size
,
maxlength
=
maxlength
)
value
=
value
,
size
=
size
,
maxlength
=
maxlength
)
...
@@ -1519,11 +1523,16 @@ class DateTimeWidget(Widget):
...
@@ -1519,11 +1523,16 @@ class DateTimeWidget(Widget):
if
style
==
'text'
:
if
style
==
'text'
:
return
render_element
(
"input"
,
type
=
"text"
,
return
render_element
(
"input"
,
type
=
"text"
,
css_class
=
field
.
get_value
(
'css_class'
),
name
=
field
.
generate_subfield_key
(
name
,
key
=
key
),
name
=
field
.
generate_subfield_key
(
name
,
key
=
key
),
value
=
value
,
size
=
size
,
maxlength
=
maxlength
)
value
=
value
,
size
=
size
,
maxlength
=
maxlength
)
if
name
==
'year'
:
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'
:
elif
name
==
'month'
:
items
=
self
.
create_items
(
1
,
13
,
digits
=
2
)
items
=
self
.
create_items
(
1
,
13
,
digits
=
2
)
elif
name
==
'day'
:
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