From 1a47dd21652440af2525fc32eb5581e2872dbed1 Mon Sep 17 00:00:00 2001 From: Patrick Mayr Date: Fri, 18 Jul 2025 11:34:12 +0200 Subject: [PATCH] Add autofocus to firstname field --- fet2020/rental/forms.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fet2020/rental/forms.py b/fet2020/rental/forms.py index 90f474ff..366ce88f 100644 --- a/fet2020/rental/forms.py +++ b/fet2020/rental/forms.py @@ -38,6 +38,11 @@ class RentalCreateForm(forms.ModelForm): "date_end": DateInput(format=("%Y-%m-%d")), } + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) # to get the self.fields set + + self.fields["firstname"].autofocus = True + class RentalAdminForm(forms.ModelForm): class Meta: