Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
chris
repanier
Commits
8d5ca7ab
Commit
8d5ca7ab
authored
Jun 19, 2017
by
chris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
force_unicode is deprecated, and does not work with py3
parent
1a9396ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
repanier/widget/select_bootstrap.py
repanier/widget/select_bootstrap.py
+4
-4
repanier/widget/select_producer_order_unit.py
repanier/widget/select_producer_order_unit.py
+4
-4
No files found.
repanier/widget/select_bootstrap.py
View file @
8d5ca7ab
...
...
@@ -4,7 +4,7 @@ from __future__ import unicode_literals
from
itertools
import
chain
from
django
import
forms
from
django.utils.encoding
import
force_
unicode
from
django.utils.encoding
import
force_
text
from
django.utils.html
import
escape
,
conditional_escape
from
django.utils.safestring
import
mark_safe
...
...
@@ -47,7 +47,7 @@ class SelectBootstrapWidget(forms.Select):
return
mark_safe
(
output
)
def
render_option2
(
self
,
selected_choices
,
option_value
,
option_label
,
name
):
option_value
=
force_
unicode
(
option_value
)
option_value
=
force_
text
(
option_value
)
if
option_value
in
selected_choices
:
selected_html
=
' selected="selected"'
self
.
selected_choice
=
option_label
...
...
@@ -56,11 +56,11 @@ class SelectBootstrapWidget(forms.Select):
return
'<li><a href="javascript:%s_select(
\'
%s
\'
,
\'
%s
\'
)" data-value="%s"%s>%s</a></li>'
%
(
name
,
option_value
,
option_label
,
escape
(
option_value
),
selected_html
,
conditional_escape
(
force_
unicode
(
option_label
)))
conditional_escape
(
force_
text
(
option_label
)))
def
render_options2
(
self
,
choices
,
selected_choices
,
name
):
# Normalize to strings.
selected_choices
=
set
([
force_
unicode
(
v
)
for
v
in
selected_choices
])
selected_choices
=
set
([
force_
text
(
v
)
for
v
in
selected_choices
])
output
=
[]
for
option_value
,
option_label
in
chain
(
self
.
choices
,
choices
):
output
.
append
(
self
.
render_option2
(
selected_choices
,
option_value
,
option_label
,
name
))
...
...
repanier/widget/select_producer_order_unit.py
View file @
8d5ca7ab
...
...
@@ -4,7 +4,7 @@ from __future__ import unicode_literals
from
itertools
import
chain
from
django
import
forms
from
django.utils.encoding
import
force_
unicode
from
django.utils.encoding
import
force_
text
from
django.utils.html
import
escape
,
conditional_escape
from
django.utils.safestring
import
mark_safe
from
django.utils.translation
import
ugettext_lazy
as
_
...
...
@@ -126,7 +126,7 @@ class SelectProducerOrderUnitWidget(forms.Select):
return
mark_safe
(
output
)
def
render_option2
(
self
,
selected_choices
,
option_value
,
option_label
,
name
):
option_value
=
force_
unicode
(
option_value
)
option_value
=
force_
text
(
option_value
)
if
option_value
in
selected_choices
:
selected_html
=
' selected="selected"'
self
.
selected_choice
=
option_label
...
...
@@ -167,11 +167,11 @@ class SelectProducerOrderUnitWidget(forms.Select):
name
,
option_value
,
option_label
,
increment_order_quantity_label
,
stock_label
,
increment_order_quantity_addon
,
stock_addon
,
price_addon
,
escape
(
option_value
),
selected_html
,
conditional_escape
(
force_
unicode
(
option_label
)))
conditional_escape
(
force_
text
(
option_label
)))
def
render_options2
(
self
,
choices
,
selected_choices
,
name
):
# Normalize to strings.
selected_choices
=
set
([
force_
unicode
(
v
)
for
v
in
selected_choices
])
selected_choices
=
set
([
force_
text
(
v
)
for
v
in
selected_choices
])
output
=
[]
for
option_value
,
option_label
in
chain
(
self
.
choices
,
choices
):
output
.
append
(
self
.
render_option2
(
selected_choices
,
option_value
,
option_label
,
name
))
...
...
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