Disable autocomplete on datetime form fields (#224)

The actual issue here is that the readonly property is no longer working. This
should be fixed in a separate commit.
This commit is contained in:
Christopher C. Wells 2021-06-19 15:20:03 -07:00
parent d8cb7bb5a2
commit a2da7e32f9
1 changed files with 12 additions and 0 deletions

View File

@ -94,6 +94,7 @@ class ChildForm(forms.ModelForm):
fields.append('picture') fields.append('picture')
widgets = { widgets = {
'birth_date': forms.DateInput(attrs={ 'birth_date': forms.DateInput(attrs={
'autocomplete': 'off',
'readonly': 'readonly', 'readonly': 'readonly',
'data-target': '#datetimepicker_date', 'data-target': '#datetimepicker_date',
}), }),
@ -126,6 +127,7 @@ class DiaperChangeForm(CoreModelForm):
fields = ['child', 'time', 'wet', 'solid', 'color', 'amount', 'notes'] fields = ['child', 'time', 'wet', 'solid', 'color', 'amount', 'notes']
widgets = { widgets = {
'time': forms.DateTimeInput(attrs={ 'time': forms.DateTimeInput(attrs={
'autocomplete': 'off',
'readonly': 'readonly', 'readonly': 'readonly',
'data-target': '#datetimepicker_time', 'data-target': '#datetimepicker_time',
}), }),
@ -139,10 +141,12 @@ class FeedingForm(CoreModelForm):
fields = ['child', 'start', 'end', 'type', 'method', 'amount', 'notes'] fields = ['child', 'start', 'end', 'type', 'method', 'amount', 'notes']
widgets = { widgets = {
'start': forms.DateTimeInput(attrs={ 'start': forms.DateTimeInput(attrs={
'autocomplete': 'off',
'readonly': 'readonly', 'readonly': 'readonly',
'data-target': '#datetimepicker_start', 'data-target': '#datetimepicker_start',
}), }),
'end': forms.DateTimeInput(attrs={ 'end': forms.DateTimeInput(attrs={
'autocomplete': 'off',
'readonly': 'readonly', 'readonly': 'readonly',
'data-target': '#datetimepicker_end', 'data-target': '#datetimepicker_end',
}), }),
@ -156,6 +160,7 @@ class NoteForm(CoreModelForm):
fields = ['child', 'note', 'time'] fields = ['child', 'note', 'time']
widgets = { widgets = {
'time': forms.DateTimeInput(attrs={ 'time': forms.DateTimeInput(attrs={
'autocomplete': 'off',
'readonly': 'readonly', 'readonly': 'readonly',
'data-target': '#datetimepicker_time', 'data-target': '#datetimepicker_time',
}), }),
@ -168,10 +173,12 @@ class SleepForm(CoreModelForm):
fields = ['child', 'start', 'end', 'notes'] fields = ['child', 'start', 'end', 'notes']
widgets = { widgets = {
'start': forms.DateTimeInput(attrs={ 'start': forms.DateTimeInput(attrs={
'autocomplete': 'off',
'readonly': 'readonly', 'readonly': 'readonly',
'data-target': '#datetimepicker_start', 'data-target': '#datetimepicker_start',
}), }),
'end': forms.DateTimeInput(attrs={ 'end': forms.DateTimeInput(attrs={
'autocomplete': 'off',
'readonly': 'readonly', 'readonly': 'readonly',
'data-target': '#datetimepicker_end', 'data-target': '#datetimepicker_end',
}), }),
@ -185,6 +192,7 @@ class TemperatureForm(CoreModelForm):
fields = ['child', 'temperature', 'time', 'notes'] fields = ['child', 'temperature', 'time', 'notes']
widgets = { widgets = {
'time': forms.DateTimeInput(attrs={ 'time': forms.DateTimeInput(attrs={
'autocomplete': 'off',
'readonly': 'readonly', 'readonly': 'readonly',
'data-target': '#datetimepicker_time', 'data-target': '#datetimepicker_time',
}), }),
@ -198,6 +206,7 @@ class TimerForm(CoreModelForm):
fields = ['child', 'name', 'start'] fields = ['child', 'name', 'start']
widgets = { widgets = {
'start': forms.DateTimeInput(attrs={ 'start': forms.DateTimeInput(attrs={
'autocomplete': 'off',
'readonly': 'readonly', 'readonly': 'readonly',
'data-target': '#datetimepicker_start', 'data-target': '#datetimepicker_start',
}) })
@ -220,10 +229,12 @@ class TummyTimeForm(CoreModelForm):
fields = ['child', 'start', 'end', 'milestone'] fields = ['child', 'start', 'end', 'milestone']
widgets = { widgets = {
'start': forms.DateTimeInput(attrs={ 'start': forms.DateTimeInput(attrs={
'autocomplete': 'off',
'readonly': 'readonly', 'readonly': 'readonly',
'data-target': '#datetimepicker_start', 'data-target': '#datetimepicker_start',
}), }),
'end': forms.DateTimeInput(attrs={ 'end': forms.DateTimeInput(attrs={
'autocomplete': 'off',
'readonly': 'readonly', 'readonly': 'readonly',
'data-target': '#datetimepicker_end', 'data-target': '#datetimepicker_end',
}), }),
@ -236,6 +247,7 @@ class WeightForm(CoreModelForm):
fields = ['child', 'weight', 'date', 'notes'] fields = ['child', 'weight', 'date', 'notes']
widgets = { widgets = {
'date': forms.DateInput(attrs={ 'date': forms.DateInput(attrs={
'autocomplete': 'off',
'readonly': 'readonly', 'readonly': 'readonly',
'data-target': '#datetimepicker_date', 'data-target': '#datetimepicker_date',
}), }),