2017-08-16 18:17:27 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django import forms
|
|
|
|
|
2017-08-17 01:57:01 +00:00
|
|
|
from .models import Child, DiaperChange, Feeding, Sleep, Timer, TummyTime
|
2017-08-16 18:17:27 +00:00
|
|
|
|
|
|
|
|
2017-08-16 18:57:46 +00:00
|
|
|
class ChildForm(forms.ModelForm):
|
2017-08-16 18:17:27 +00:00
|
|
|
class Meta:
|
|
|
|
model = Child
|
|
|
|
fields = ['first_name', 'last_name', 'birth_date']
|
|
|
|
widgets = {
|
|
|
|
'birth_date': forms.DateInput(attrs={
|
|
|
|
'class': 'datepicker-input',
|
|
|
|
'data-toggle': 'datetimepicker',
|
|
|
|
'data-target': '#id_birth_date',
|
|
|
|
}),
|
|
|
|
}
|
2017-08-16 18:57:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DiaperChangeForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = DiaperChange
|
|
|
|
fields = ['child', 'time', 'wet', 'solid', 'color']
|
|
|
|
widgets = {
|
|
|
|
'time': forms.DateTimeInput(attrs={
|
|
|
|
'class': 'datepicker-input',
|
|
|
|
'data-toggle': 'datetimepicker',
|
|
|
|
'data-target': '#id_time',
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class FeedingForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Feeding
|
2017-08-16 22:07:25 +00:00
|
|
|
fields = ['child', 'start', 'end', 'type', 'method', 'amount']
|
2017-08-16 18:57:46 +00:00
|
|
|
widgets = {
|
|
|
|
'start': forms.DateTimeInput(attrs={
|
|
|
|
'class': 'datepicker-input',
|
|
|
|
'data-toggle': 'datetimepicker',
|
|
|
|
'data-target': '#id_start',
|
|
|
|
}),
|
|
|
|
'end': forms.DateTimeInput(attrs={
|
|
|
|
'class': 'datepicker-input',
|
|
|
|
'data-toggle': 'datetimepicker',
|
|
|
|
'data-target': '#id_end',
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class SleepForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Sleep
|
|
|
|
fields = ['child', 'start', 'end']
|
|
|
|
widgets = {
|
|
|
|
'start': forms.DateTimeInput(attrs={
|
|
|
|
'class': 'datepicker-input',
|
|
|
|
'data-toggle': 'datetimepicker',
|
|
|
|
'data-target': '#id_start',
|
|
|
|
}),
|
|
|
|
'end': forms.DateTimeInput(attrs={
|
|
|
|
'class': 'datepicker-input',
|
|
|
|
'data-toggle': 'datetimepicker',
|
|
|
|
'data-target': '#id_end',
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-08-17 01:57:01 +00:00
|
|
|
class TimerForm(forms.ModelForm):
|
|
|
|
next = forms.CharField(required=False)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = Timer
|
|
|
|
fields = ['name']
|
|
|
|
|
|
|
|
|
2017-08-16 18:57:46 +00:00
|
|
|
class TummyTimeForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = TummyTime
|
|
|
|
fields = ['child', 'start', 'end', 'milestone']
|
|
|
|
widgets = {
|
|
|
|
'start': forms.DateTimeInput(attrs={
|
|
|
|
'class': 'datepicker-input',
|
|
|
|
'data-toggle': 'datetimepicker',
|
|
|
|
'data-target': '#id_start',
|
|
|
|
}),
|
|
|
|
'end': forms.DateTimeInput(attrs={
|
|
|
|
'class': 'datepicker-input',
|
|
|
|
'data-toggle': 'datetimepicker',
|
|
|
|
'data-target': '#id_end',
|
|
|
|
}),
|
|
|
|
}
|