diff --git a/fet2020/finance/forms.py b/fet2020/finance/forms.py index 20ae469c..851f0178 100644 --- a/fet2020/finance/forms.py +++ b/fet2020/finance/forms.py @@ -75,6 +75,8 @@ class BillCreateForm(forms.ModelForm): self.fields["invoice"].rows = 3 # bank data fields + self.fields["payer"].autofocus = True + self.fields["name_text"].label = "Kontoinhaber:in" self.fields["name_text"].required = False @@ -221,6 +223,8 @@ class BillUpdateForm(forms.ModelForm): if kwargs["instance"].status != "S": self.fields["comment"].disabled = True + self.fields["comment"].autofocus = True + class ResolutionCreateForm(forms.ModelForm): class Meta: @@ -244,6 +248,11 @@ class ResolutionCreateForm(forms.ModelForm): "date": DateInput(format=("%Y-%m-%d")), } + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) # to get the self.fields set + + self.fields["option"].autofocus = True + class BillInlineForm(forms.ModelForm): class Meta: diff --git a/fet2020/posts/forms.py b/fet2020/posts/forms.py index 4aeaf079..de146162 100644 --- a/fet2020/posts/forms.py +++ b/fet2020/posts/forms.py @@ -119,7 +119,7 @@ class FetMeetingForm(PostForm): } help_texts = { - "event_end": "Bei leeren Eingabe werden 2h zur Startzeit dazugezählt.", + "event_end": "Bei leerer Eingabe werden 2h zur Startzeit dazugezählt.", "tags": ( "Die Hashtags ohne '#' eintragen, und mit Komma kann man mehrere Tags anfügen." ), @@ -219,7 +219,7 @@ class FetMeetingCreateForm(forms.ModelForm): fields = ["event_start", "event_end", "event_place"] help_texts = { - "event_end": "Bei leeren Eingabe werden 2h zur Startzeit dazugezählt.", + "event_end": "Bei leerer Eingabe werden 2h zur Startzeit dazugezählt.", } labels = { @@ -232,6 +232,8 @@ class FetMeetingCreateForm(forms.ModelForm): super().__init__(*args, **kwargs) # to get the self.fields set self.fields["event_start"].required = True + self.fields["event_start"].autofocus = True + self.fields["event_end"].required = False self.fields["event_place"].initial = "FET" diff --git a/fet2020/templates/baseform/checkbox.html b/fet2020/templates/baseform/checkbox.html index 3b706281..f3341c77 100644 --- a/fet2020/templates/baseform/checkbox.html +++ b/fet2020/templates/baseform/checkbox.html @@ -10,6 +10,7 @@ {% if field.field.required %}required{% endif %} {% if field.field.disabled %}disabled{% endif %} {% if field.value %}checked{% endif %} + {% if field.field.autofocus %}autofocus{% endif %} class="rounded border-gray-300 dark:border-none text-proprietary shadow-sm focus:border-blue-300 focus:ring focus:ring-offset-0 focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" > {{ field.label }} diff --git a/fet2020/templates/baseform/date.html b/fet2020/templates/baseform/date.html index 9a6a843e..c40332a7 100644 --- a/fet2020/templates/baseform/date.html +++ b/fet2020/templates/baseform/date.html @@ -12,6 +12,7 @@ {% if field.value %}value="{{ field.value|date:"Y-m-d" }}"{% endif %} {% if field.field.required %}required{% endif %} {% if field.field.disabled %}disabled{% endif %} + {% if field.field.autofocus %}autofocus{% endif %} class="block w-full mt-1 rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" > {% if field.help_text %} diff --git a/fet2020/templates/baseform/date_time.html b/fet2020/templates/baseform/date_time.html index 2d114bfe..8a535fac 100644 --- a/fet2020/templates/baseform/date_time.html +++ b/fet2020/templates/baseform/date_time.html @@ -12,6 +12,7 @@ value="{{ field.value|date:"Y-m-d" }}" {% if field.field.required %}required{% endif %} {% if field.field.disabled %}disabled{% endif %} + {% if field.field.autofocus %}autofocus{% endif %} class="block w-full mt-1 rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" > {% if field.help_text %} diff --git a/fet2020/templates/baseform/password.html b/fet2020/templates/baseform/password.html index 0e9731a0..17a49b27 100644 --- a/fet2020/templates/baseform/password.html +++ b/fet2020/templates/baseform/password.html @@ -11,6 +11,7 @@ name="{{ field.name }}" {% if field.field.required %}required{% endif %} {% if field.field.disabled %}disabled{% endif %} + {% if field.field.autofocus %}autofocus{% endif %} class="mt-1 block w-full rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" > {% if field.help_text %} diff --git a/fet2020/templates/baseform/select.html b/fet2020/templates/baseform/select.html index ee37c873..4bd40ee6 100644 --- a/fet2020/templates/baseform/select.html +++ b/fet2020/templates/baseform/select.html @@ -9,6 +9,7 @@ name="{{ field.name }}" {% if field.field.required %}required{% endif %} {% if field.field.disabled %}disabled{% endif %} + {% if field.field.autofocus %}autofocus{% endif %} class="block {% if field.field.disabled %}bg-gray-200 dark:text-gray-500{% endif %} w-full mt-1 rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" > {% for elem in field %} diff --git a/fet2020/templates/baseform/text.html b/fet2020/templates/baseform/text.html index cf407781..779655b0 100644 --- a/fet2020/templates/baseform/text.html +++ b/fet2020/templates/baseform/text.html @@ -11,6 +11,7 @@ {% if field.value %}value="{{ field.value }}"{% endif %} {% if field.field.required %}required{% endif %} {% if field.field.disabled %}disabled{% endif %} + {% if field.field.autofocus %}autofocus{% endif %} class="mt-1 block w-full disabled:bg-gray-200 rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" > {% if field.help_text %} diff --git a/fet2020/templates/baseform/text_with_suggestions.html b/fet2020/templates/baseform/text_with_suggestions.html index ce974f6b..f8a7725c 100644 --- a/fet2020/templates/baseform/text_with_suggestions.html +++ b/fet2020/templates/baseform/text_with_suggestions.html @@ -13,6 +13,7 @@ {% if field.value %}value="{{ field.value }}"{% endif %} {% if field.field.required %}required{% endif %} {% if field.field.disabled %}disabled{% endif %} + {% if field.field.autofocus %}autofocus{% endif %} class="mt-1 block w-full disabled:bg-gray-200 rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" > diff --git a/fet2020/templates/baseform/textarea.html b/fet2020/templates/baseform/textarea.html index 8f03fcd8..2b380e50 100644 --- a/fet2020/templates/baseform/textarea.html +++ b/fet2020/templates/baseform/textarea.html @@ -9,6 +9,7 @@ name="{{ field.name }}" {% if field.field.required %}required{% endif %} {% if field.field.disabled %}disabled{% endif %} + {% if field.field.autofocus %}autofocus{% endif %} {% if field.field.placeholder %}placeholder="{{ field.field.placeholder }}"{% endif %} {% if field.field.rows %}rows="{{ field.field.rows }}"{% endif %} class="mt-1 block w-full disabled:bg-gray-200 rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50"