🚨 fixes wrong code styling

This commit is contained in:
Jean-Louis Jouannic 2022-07-07 13:41:35 +02:00 committed by Christopher Charbonneau Wells
parent d8aa3acf91
commit 94c557d3b8
2 changed files with 12 additions and 11 deletions

View File

@ -157,8 +157,7 @@ class PumpingForm(CoreModelForm):
class DiaperChangeForm(CoreModelForm, TaggableModelForm): class DiaperChangeForm(CoreModelForm, TaggableModelForm):
class Meta: class Meta:
model = models.DiaperChange model = models.DiaperChange
fields = ["child", "time", "wet", "solid", "color", "amount", "notes", fields = ["child", "time", "wet", "solid", "color", "amount", "notes", "tags"]
"tags"]
widgets = { widgets = {
"child": ChildRadioSelect(), "child": ChildRadioSelect(),
"time": forms.DateTimeInput( "time": forms.DateTimeInput(
@ -174,8 +173,7 @@ class DiaperChangeForm(CoreModelForm, TaggableModelForm):
class FeedingForm(CoreModelForm, TaggableModelForm): class FeedingForm(CoreModelForm, TaggableModelForm):
class Meta: class Meta:
model = models.Feeding model = models.Feeding
fields = ["child", "start", "end", "type", "method", "amount", "notes", fields = ["child", "start", "end", "type", "method", "amount", "notes", "tags"]
"tags"]
widgets = { widgets = {
"child": ChildRadioSelect, "child": ChildRadioSelect,
"start": forms.DateTimeInput( "start": forms.DateTimeInput(
@ -205,7 +203,7 @@ class NoteForm(CoreModelForm, TaggableModelForm):
"autocomplete": "off", "autocomplete": "off",
"data-target": "#datetimepicker_time", "data-target": "#datetimepicker_time",
} }
) ),
} }
@ -248,7 +246,6 @@ class TemperatureForm(CoreModelForm, TaggableModelForm):
class TimerForm(CoreModelForm): class TimerForm(CoreModelForm):
class Meta: class Meta:
model = models.Timer model = models.Timer
fields = ["child", "name", "start"] fields = ["child", "name", "start"]
@ -259,7 +256,7 @@ class TimerForm(CoreModelForm):
"autocomplete": "off", "autocomplete": "off",
"data-target": "#datetimepicker_start", "data-target": "#datetimepicker_start",
} }
) ),
} }
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -88,8 +88,12 @@ class ChildRadioSelect(RadioSelect):
template_name = "core/child_radio.html" template_name = "core/child_radio.html"
option_template_name = "core/child_radio_option.html" option_template_name = "core/child_radio_option.html"
def create_option(self, name, value, label, selected, index, subindex=None, attrs=None): def create_option(
option = super().create_option(name, value, label, selected, index, subindex, attrs) self, name, value, label, selected, index, subindex=None, attrs=None
if value != '': ):
option['picture'] = value.instance.picture option = super().create_option(
name, value, label, selected, index, subindex, attrs
)
if value != "":
option["picture"] = value.instance.picture
return option return option