Skip to content

Commit

Permalink
feat: Apply advanced fields to all forms
Browse files Browse the repository at this point in the history
  • Loading branch information
billybonks committed Feb 7, 2024
1 parent ce80aa9 commit af2b31c
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions core/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,14 @@ class Meta:


class SleepForm(CoreModelForm, TaggableModelForm):
fieldsets = [
{
"fields": ["child", "start", "end", "nap"],
"layout": "required",
},
{"layout": "advanced", "fields": ["notes", "tags"]},
]

class Meta:
model = models.Sleep
fields = ["child", "start", "end", "nap", "notes", "tags"]
Expand All @@ -289,6 +297,14 @@ class Meta:


class TemperatureForm(CoreModelForm, TaggableModelForm):
fieldsets = [
{
"fields": ["child", "temperature", "time"],
"layout": "required",
},
{"layout": "advanced", "fields": ["notes", "tags"]},
]

class Meta:
model = models.Temperature
fields = ["child", "temperature", "time", "notes", "tags"]
Expand Down Expand Up @@ -320,6 +336,14 @@ def save(self, commit=True):


class TummyTimeForm(CoreModelForm, TaggableModelForm):
fieldsets = [
{
"fields": ["child", "start", "end", "milestone"],
"layout": "required",
},
{"layout": "advanced", "fields": ["tags"]},
]

class Meta:
model = models.TummyTime
fields = ["child", "start", "end", "milestone", "tags"]
Expand All @@ -331,6 +355,14 @@ class Meta:


class WeightForm(CoreModelForm, TaggableModelForm):
fieldsets = [
{
"fields": ["child", "weight", "date"],
"layout": "required",
},
{"layout": "advanced", "fields": ["notes", "tags"]},
]

class Meta:
model = models.Weight
fields = ["child", "weight", "date", "notes", "tags"]
Expand All @@ -342,6 +374,14 @@ class Meta:


class HeightForm(CoreModelForm, TaggableModelForm):
fieldsets = [
{
"fields": ["child", "height", "date"],
"layout": "required",
},
{"layout": "advanced", "fields": ["notes", "tags"]},
]

class Meta:
model = models.Height
fields = ["child", "height", "date", "notes", "tags"]
Expand All @@ -353,6 +393,14 @@ class Meta:


class HeadCircumferenceForm(CoreModelForm, TaggableModelForm):
fieldsets = [
{
"fields": ["child", "head_circumference", "date"],
"layout": "required",
},
{"layout": "advanced", "fields": ["notes", "tags"]},
]

class Meta:
model = models.HeadCircumference
fields = ["child", "head_circumference", "date", "notes", "tags"]
Expand All @@ -364,6 +412,14 @@ class Meta:


class BMIForm(CoreModelForm, TaggableModelForm):
fieldsets = [
{
"fields": ["child", "bmi", "date"],
"layout": "required",
},
{"layout": "advanced", "fields": ["notes", "tags"]},
]

class Meta:
model = models.BMI
fields = ["child", "bmi", "date", "notes", "tags"]
Expand Down

0 comments on commit af2b31c

Please sign in to comment.