feat: use pill radio and include advanced fields on feeding form

This commit is contained in:
billybonks 2024-02-07 15:18:45 +08:00 committed by Christopher Charbonneau Wells
parent 66ccc1c6c8
commit 5ec806ef86
1 changed files with 10 additions and 0 deletions

View File

@ -216,6 +216,14 @@ class DiaperChangeForm(CoreModelForm, TaggableModelForm):
class FeedingForm(CoreModelForm, TaggableModelForm): class FeedingForm(CoreModelForm, TaggableModelForm):
fieldsets = [
{
"fields": ["child", "start", "end", "type", "method", "amount"],
"layout": "required",
},
{"layout": "advanced", "fields": ["notes", "tags"]},
]
class Meta: class Meta:
model = models.Feeding model = models.Feeding
fields = ["child", "start", "end", "type", "method", "amount", "notes", "tags"] fields = ["child", "start", "end", "type", "method", "amount", "notes", "tags"]
@ -223,6 +231,8 @@ class FeedingForm(CoreModelForm, TaggableModelForm):
"child": ChildRadioSelect, "child": ChildRadioSelect,
"start": DateTimeInput(), "start": DateTimeInput(),
"end": DateTimeInput(), "end": DateTimeInput(),
"type": PillRadioSelect(),
"method": PillRadioSelect(),
"notes": forms.Textarea(attrs={"rows": 5}), "notes": forms.Textarea(attrs={"rows": 5}),
} }