summaryrefslogtreecommitdiff
path: root/archaeological_operations/widgets.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-03-19 11:21:04 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-03-19 11:21:04 +0100
commitced270d071384046eb3b9a85572dc817c7ef042c (patch)
tree1696a72b2ec46fa34981533484e0d67ec9d14e93 /archaeological_operations/widgets.py
parentbaf29e1bb4b18fb9830956c53f3475db2f828e3f (diff)
downloadIshtar-ced270d071384046eb3b9a85572dc817c7ef042c.tar.bz2
Ishtar-ced270d071384046eb3b9a85572dc817c7ef042c.zip
Format - black: operation
Diffstat (limited to 'archaeological_operations/widgets.py')
-rw-r--r--archaeological_operations/widgets.py29
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)