diff options
Diffstat (limited to 'archaeological_operations/widgets.py')
-rw-r--r-- | archaeological_operations/widgets.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/archaeological_operations/widgets.py b/archaeological_operations/widgets.py index 247fafba5..1494d0c14 100644 --- a/archaeological_operations/widgets.py +++ b/archaeological_operations/widgets.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (C) 2013-2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> @@ -28,11 +28,11 @@ from ishtar_common.utils import ugettext_lazy as _ class ParcelWidget(widgets.MultiWidget): def __init__(self, attrs=None): if not attrs: - attrs = {'class': 'widget-parcel'} - elif 'class' not in attrs: - attrs['class'] = 'widget-parcel' + attrs = {"class": "widget-parcel"} + elif "class" not in attrs: + attrs["class"] = "widget-parcel" else: - attrs['class'] += ' widget-parcel' + attrs["class"] += " widget-parcel" _widgets = ( widgets.TextInput(attrs=attrs), widgets.TextInput(attrs=attrs), @@ -46,7 +46,7 @@ class ParcelWidget(widgets.MultiWidget): return [None, None] def format_output(self, rendered_widgets): - return ' / '.join(rendered_widgets) + return " / ".join(rendered_widgets) class SelectParcelWidget(widgets.TextInput): @@ -56,7 +56,9 @@ class SelectParcelWidget(widgets.TextInput): <div class="input-group-append"> <button class='input-group-text btn btn-success' name='formset_add' value='add'>{}</button> - </div>""".format(render, _("Add")) + </div>""".format( + render, _("Add") + ) return mark_safe(html) @@ -64,11 +66,12 @@ class OAWidget(forms.TextInput): def render(self, name, value, attrs=None, renderer=None): if not value: value = "" - final_attrs = flatatt( - self.build_attrs(attrs, {'name': name, 'value': value})) - dct = {'final_attrs': final_attrs, - 'id': attrs['id'], - "safe_id": attrs['id'].replace('-', '_')} - t = loader.get_template('ishtar/blocks/OAWidget.html') + final_attrs = flatatt(self.build_attrs(attrs, {"name": name, "value": value})) + dct = { + "final_attrs": final_attrs, + "id": attrs["id"], + "safe_id": attrs["id"].replace("-", "_"), + } + t = loader.get_template("ishtar/blocks/OAWidget.html") rendered = t.render(dct) return mark_safe(rendered) |