From 94c557d3b87293a15eb6dde70e9cb01618316527 Mon Sep 17 00:00:00 2001 From: Jean-Louis Jouannic Date: Thu, 7 Jul 2022 13:41:35 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20fixes=20wrong=20code=20styling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/forms.py | 11 ++++------- core/widgets.py | 12 ++++++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/core/forms.py b/core/forms.py index 15acc73b..3fffaf2c 100644 --- a/core/forms.py +++ b/core/forms.py @@ -157,8 +157,7 @@ class PumpingForm(CoreModelForm): class DiaperChangeForm(CoreModelForm, TaggableModelForm): class Meta: model = models.DiaperChange - fields = ["child", "time", "wet", "solid", "color", "amount", "notes", - "tags"] + fields = ["child", "time", "wet", "solid", "color", "amount", "notes", "tags"] widgets = { "child": ChildRadioSelect(), "time": forms.DateTimeInput( @@ -174,8 +173,7 @@ class DiaperChangeForm(CoreModelForm, TaggableModelForm): class FeedingForm(CoreModelForm, TaggableModelForm): class Meta: model = models.Feeding - fields = ["child", "start", "end", "type", "method", "amount", "notes", - "tags"] + fields = ["child", "start", "end", "type", "method", "amount", "notes", "tags"] widgets = { "child": ChildRadioSelect, "start": forms.DateTimeInput( @@ -205,7 +203,7 @@ class NoteForm(CoreModelForm, TaggableModelForm): "autocomplete": "off", "data-target": "#datetimepicker_time", } - ) + ), } @@ -248,7 +246,6 @@ class TemperatureForm(CoreModelForm, TaggableModelForm): class TimerForm(CoreModelForm): - class Meta: model = models.Timer fields = ["child", "name", "start"] @@ -259,7 +256,7 @@ class TimerForm(CoreModelForm): "autocomplete": "off", "data-target": "#datetimepicker_start", } - ) + ), } def __init__(self, *args, **kwargs): diff --git a/core/widgets.py b/core/widgets.py index de2383fc..7f708cbf 100644 --- a/core/widgets.py +++ b/core/widgets.py @@ -88,8 +88,12 @@ class ChildRadioSelect(RadioSelect): template_name = "core/child_radio.html" option_template_name = "core/child_radio_option.html" - def create_option(self, name, value, label, selected, index, subindex=None, attrs=None): - option = super().create_option(name, value, label, selected, index, subindex, attrs) - if value != '': - option['picture'] = value.instance.picture + def create_option( + self, name, value, label, selected, index, subindex=None, attrs=None + ): + option = super().create_option( + name, value, label, selected, index, subindex, attrs + ) + if value != "": + option["picture"] = value.instance.picture return option