Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bootstrap_select/widgets.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.templatetags.static import static
from django import forms
from django.forms import Select
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.html import format_html
from django.utils.safestring import mark_safe

Expand Down Expand Up @@ -49,7 +49,7 @@ def __init__(self, attrs=None, choices=(), **kwargs):
def render_option(self, selected_choices, option_value, option_label):
if option_value is None:
option_value = ''
option_value = force_text(option_value)
option_value = force_str(option_value)
if option_value in selected_choices:
selected_html = mark_safe(' selected="selected"')
if not self.allow_multiple_selected:
Expand All @@ -59,10 +59,10 @@ def render_option(self, selected_choices, option_value, option_label):
selected_html = ''

html = '<option value="{}"'.format(option_value)
html += ' data-content="{}"'.format(force_text(option_label))
html += ' data-content="{}"'.format(force_str(option_label))
if self.attrs.get('data-live-search'):
html += ' data-tokens="{}"'.format(option_value)
html += '{}>{}</option>'.format(selected_html, force_text(option_label))
html += '{}>{}</option>'.format(selected_html, force_str(option_label))
return format_html(html)

# Django 1.11
Expand Down
5 changes: 3 additions & 2 deletions example/example/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
note: django.conf.urls was deleted in 4.2, use re_path instead
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.urls import re_path
from django.contrib import admin


urlpatterns = [
url(r'^admin/', admin.site.urls),
re_path(r'^admin/', admin.site.urls),
]