Set all datetime fields to `readonly`

This commit is contained in:
Christopher C. Wells 2020-01-27 20:07:42 -08:00 committed by Christopher Charbonneau Wells
parent 073bb37d3d
commit b8e2416cd1
1 changed files with 11 additions and 0 deletions

View File

@ -61,6 +61,7 @@ class ChildForm(forms.ModelForm):
fields.append('picture') fields.append('picture')
widgets = { widgets = {
'birth_date': forms.DateInput(attrs={ 'birth_date': forms.DateInput(attrs={
'readonly': 'readonly',
'class': 'datetimepicker-input', 'class': 'datetimepicker-input',
'data-target': '#datetimepicker_date', 'data-target': '#datetimepicker_date',
}), }),
@ -93,6 +94,7 @@ class DiaperChangeForm(forms.ModelForm):
fields = ['child', 'time', 'wet', 'solid', 'color', 'amount'] fields = ['child', 'time', 'wet', 'solid', 'color', 'amount']
widgets = { widgets = {
'time': forms.DateTimeInput(attrs={ 'time': forms.DateTimeInput(attrs={
'readonly': 'readonly',
'class': 'datetimepicker-input', 'class': 'datetimepicker-input',
'data-target': '#datetimepicker_time', 'data-target': '#datetimepicker_time',
}), }),
@ -109,10 +111,12 @@ class FeedingForm(forms.ModelForm):
fields = ['child', 'start', 'end', 'type', 'method', 'amount'] fields = ['child', 'start', 'end', 'type', 'method', 'amount']
widgets = { widgets = {
'start': forms.DateTimeInput(attrs={ 'start': forms.DateTimeInput(attrs={
'readonly': 'readonly',
'class': 'datetimepicker-input', 'class': 'datetimepicker-input',
'data-target': '#datetimepicker_start', 'data-target': '#datetimepicker_start',
}), }),
'end': forms.DateTimeInput(attrs={ 'end': forms.DateTimeInput(attrs={
'readonly': 'readonly',
'class': 'datetimepicker-input', 'class': 'datetimepicker-input',
'data-target': '#datetimepicker_end', 'data-target': '#datetimepicker_end',
}), }),
@ -150,10 +154,12 @@ class SleepForm(forms.ModelForm):
fields = ['child', 'start', 'end'] fields = ['child', 'start', 'end']
widgets = { widgets = {
'start': forms.DateTimeInput(attrs={ 'start': forms.DateTimeInput(attrs={
'readonly': 'readonly',
'class': 'datetimepicker-input', 'class': 'datetimepicker-input',
'data-target': '#datetimepicker_start', 'data-target': '#datetimepicker_start',
}), }),
'end': forms.DateTimeInput(attrs={ 'end': forms.DateTimeInput(attrs={
'readonly': 'readonly',
'class': 'datetimepicker-input', 'class': 'datetimepicker-input',
'data-target': '#datetimepicker_end', 'data-target': '#datetimepicker_end',
}), }),
@ -180,6 +186,7 @@ class TemperatureForm(forms.ModelForm):
fields = ['child', 'temperature', 'time'] fields = ['child', 'temperature', 'time']
widgets = { widgets = {
'time': forms.DateTimeInput(attrs={ 'time': forms.DateTimeInput(attrs={
'readonly': 'readonly',
'class': 'datetimepicker-input', 'class': 'datetimepicker-input',
'data-target': '#datetimepicker_time', 'data-target': '#datetimepicker_time',
}), }),
@ -196,6 +203,7 @@ class TimerForm(forms.ModelForm):
fields = ['name', 'start'] fields = ['name', 'start']
widgets = { widgets = {
'start': forms.DateTimeInput(attrs={ 'start': forms.DateTimeInput(attrs={
'readonly': 'readonly',
'class': 'datetimepicker-input', 'class': 'datetimepicker-input',
'data-target': '#datetimepicker_start', 'data-target': '#datetimepicker_start',
}) })
@ -218,10 +226,12 @@ class TummyTimeForm(forms.ModelForm):
fields = ['child', 'start', 'end', 'milestone'] fields = ['child', 'start', 'end', 'milestone']
widgets = { widgets = {
'start': forms.DateTimeInput(attrs={ 'start': forms.DateTimeInput(attrs={
'readonly': 'readonly',
'class': 'datetimepicker-input', 'class': 'datetimepicker-input',
'data-target': '#datetimepicker_start', 'data-target': '#datetimepicker_start',
}), }),
'end': forms.DateTimeInput(attrs={ 'end': forms.DateTimeInput(attrs={
'readonly': 'readonly',
'class': 'datetimepicker-input', 'class': 'datetimepicker-input',
'data-target': '#datetimepicker_end', 'data-target': '#datetimepicker_end',
}), }),
@ -248,6 +258,7 @@ class WeightForm(forms.ModelForm):
fields = ['child', 'weight', 'date'] fields = ['child', 'weight', 'date']
widgets = { widgets = {
'date': forms.DateInput(attrs={ 'date': forms.DateInput(attrs={
'readonly': 'readonly',
'class': 'datetimepicker-input', 'class': 'datetimepicker-input',
'data-target': '#datetimepicker_date', 'data-target': '#datetimepicker_date',
}), }),