summaryrefslogtreecommitdiff
path: root/ishtar_common/widgets.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-04 18:54:48 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:24 +0100
commitfdea77fd9347638409ac56948c87e7f61af8847c (patch)
tree43fc3285486bace07d3ce0588c8960328664c52a /ishtar_common/widgets.py
parent8eebd435f302bacd6ad5a584cbed55919a55f4bf (diff)
downloadIshtar-fdea77fd9347638409ac56948c87e7f61af8847c.tar.bz2
Ishtar-fdea77fd9347638409ac56948c87e7f61af8847c.zip
Typo fix
Diffstat (limited to 'ishtar_common/widgets.py')
-rw-r--r--ishtar_common/widgets.py42
1 files changed, 21 insertions, 21 deletions
diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py
index 724e5d08c..67a16e4b7 100644
--- a/ishtar_common/widgets.py
+++ b/ishtar_common/widgets.py
@@ -138,26 +138,26 @@ class Select2Dynamic(Select2Media, forms.Select):
else:
attrs['style'] = "width: 370px"
options = [
- u"tags: true",
+ "tags: true",
]
'''
msg = str(
- _(u"Are you sure you want to add this term? (the addition is "
- u"effective after registration of the element)")
+ _("Are you sure you want to add this term? (the addition is "
+ "effective after registration of the element)")
)
- options.append(u"""createTag: function (params) {{
+ options.append("""createTag: function (params) {{
return confirm("{}");
}}""".format(msg))
'''
if attrs.get('full-width', None):
- options.append(u"containerCssClass: 'full-width'")
+ options.append("containerCssClass: 'full-width'")
html = super(Select2Dynamic, self).render(name, value, attrs)
html += """<script type="text/javascript">
$(document).ready(function() {{
$("#id_{}").select2({{ {} }});
}});</script>
- """.format(name, u", ".join(options))
+ """.format(name, ", ".join(options))
return mark_safe(html)
@@ -169,9 +169,9 @@ class Select2DynamicField(forms.ChoiceField):
Key can be added dynamically. Only check that the character " is not
used.
"""
- if value and u'"' in value:
+ if value and '"' in value:
raise ValidationError(
- _(u"The character \" is not accepted.")
+ _("The character \" is not accepted.")
)
def to_python(self, value):
@@ -268,7 +268,7 @@ class Select2Base(Select2Media):
new, html = "", ""
if self.new:
- html = u"<div class='input-group'>"
+ html = "<div class='input-group'>"
url_new = 'new-' + self.model.SLUG
url_new = reverse(url_new, args=["id_" + name])
# WARNING: the modal for the form must be in the main template
@@ -383,7 +383,7 @@ class DeleteWidget(forms.CheckboxInput):
attrs, {"name": name, "value": '1',
'class': "btn btn-danger"})
)
- output = u"<button%s>%s</button>" % (final_attrs, _("Delete"))
+ output = "<button%s>%s</button>" % (final_attrs, _("Delete"))
return mark_safe(output)
@@ -407,7 +407,7 @@ class SwitchWidget(forms.CheckboxInput):
if self.extra_label:
extra_label = '<label for="{}">{}</label>'.format(attrs['id'],
self.extra_label)
- output = u"""<span class="switch{}">
+ output = """<span class="switch{}">
<input{}>{}
</span>""".format(extra_class, final_attrs, extra_label)
return mark_safe(output)
@@ -415,7 +415,7 @@ class SwitchWidget(forms.CheckboxInput):
class DeleteSwitchWidget(SwitchWidget):
extra_class = "danger"
- extra_label = _(u"Delete")
+ extra_label = _("Delete")
class ImageFileInput(ClearableFileInput):
@@ -481,7 +481,7 @@ class CustomWidget(forms.TextInput):
def render(self, name, value, attrs=None, renderer=None):
if not value:
- value = u""
+ value = ""
final_attrs = flatatt(
self.build_attrs(attrs, {"name": name, "value": value}))
dct = {'final_attrs': final_attrs,
@@ -561,7 +561,7 @@ class ModelFieldMixin(object):
except self.model.DoesNotExist:
raise ValidationError(
str(
- _(u"{} is not a valid key for {}")
+ _("{} is not a valid key for {}")
).format(v, self.model)
)
if not self.multiple:
@@ -680,7 +680,7 @@ class JQueryAutoComplete(forms.TextInput):
def render(self, name, value, attrs=None, renderer=None):
attrs_hidden = self.build_attrs(attrs, {"name": name})
attrs_select = self.build_attrs(attrs)
- attrs_select['placeholder'] = _(u"Search...")
+ attrs_select['placeholder'] = _("Search...")
values = []
if value:
hiddens = []
@@ -798,7 +798,7 @@ class JQueryAutoComplete(forms.TextInput):
attrs_hidden_previous = attrs_hidden.copy()
attrs_hidden_previous['name'] += "_previous"
attrs_hidden_previous['id'] += "_previous"
- old_value += u"<input type='hidden'{}>".format(
+ old_value += "<input type='hidden'{}>".format(
flatatt(attrs_hidden_previous))
pk = None
if values:
@@ -857,7 +857,7 @@ class JQueryTown(forms.TextInput):
def render(self, name, value, attrs=None, renderer=None):
attrs_hidden = self.build_attrs(attrs, {"name": name})
attrs_select = self.build_attrs(attrs)
- attrs_select['placeholder'] = _(u"Search...")
+ attrs_select['placeholder'] = _("Search...")
selected = ''
selected_state = ''
selected_department = ''
@@ -972,7 +972,7 @@ class JQueryPersonOrganization(forms.TextInput):
def render(self, name, value, attrs=None, renderer=None):
attrs_hidden = self.build_attrs(attrs, {'name': name})
attrs_select = self.build_attrs(attrs)
- attrs_select['placeholder'] = _(u"Search...")
+ attrs_select['placeholder'] = _("Search...")
selected = ''
if value:
hiddens = []
@@ -1145,7 +1145,7 @@ class DataTable(Select2Media, forms.RadioSelect):
col_idx = []
for k in form.get_input_ids():
- col_idx.append(u'"%s"' % k)
+ col_idx.append('"%s"' % k)
col_idx = col_idx and ", ".join(col_idx) or ""
dct['encoding'] = settings.ENCODING or 'utf-8'
@@ -1183,13 +1183,13 @@ class DataTable(Select2Media, forms.RadioSelect):
'col_idx': col_idx,
'no_result': str(_("No results")),
'loading': str(_("Loading...")),
- 'remove': str(_(u"Remove")),
+ 'remove': str(_("Remove")),
'sname': name.replace('-', ''),
'gallery': self.gallery,
'use_map': self.map() if callable(self.map) else self.map,
'multiple': self.multiple,
'multiple_select': self.multiple_select,
- 'multi_cols': ",".join((u'"%d"' % col
+ 'multi_cols': ",".join(('"%d"' % col
for col in self.multiple_cols))})
t = loader.get_template('blocks/DataTables.html')
rendered += t.render(dct)