From b7d715206b0936eb89ef4cc860ed7d944945c4a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexa=20Valentov=C3=A1?= <git@imaniti.org> Date: Mon, 16 Dec 2024 19:42:57 +0100 Subject: [PATCH] fix prepopulation --- main/forms.py | 31 +++++++++++++++++++++++++++---- main/models.py | 5 +++-- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/main/forms.py b/main/forms.py index d3f378f4..cdd5604a 100644 --- a/main/forms.py +++ b/main/forms.py @@ -72,7 +72,12 @@ class CareerSubmissionForm(forms.Form): max_length=256, required=True, widget=forms.TextInput( - attrs={"placeholder": "Jméno", "class": "lg:w-auto w-full"} + attrs={ + "placeholder": "Jméno", + "class": "lg:w-auto w-full", + "value": "", + "autocomplete": "", + } ), ) @@ -81,7 +86,12 @@ class CareerSubmissionForm(forms.Form): max_length=256, required=True, widget=forms.TextInput( - attrs={"placeholder": "Příjmení", "class": "lg:w-auto w-full"} + attrs={ + "placeholder": "Příjmení", + "class": "lg:w-auto w-full", + "value": "", + "autocomplete": "", + } ), ) @@ -89,13 +99,26 @@ class CareerSubmissionForm(forms.Form): min_length=1, max_length=256, required=True, - widget=forms.EmailInput(attrs={"placeholder": "Email", "class": "w-full"}), + widget=forms.EmailInput( + attrs={ + "placeholder": "Email", + "class": "w-full", + "value": "", + "autocomplete": "", + } + ), ) phone = forms.IntegerField( required=True, widget=forms.NumberInput( - attrs={"type": "tel", "placeholder": "Telefon", "class": "w-full"} + attrs={ + "type": "tel", + "placeholder": "Telefon", + "class": "w-full", + "value": "", + "autocomplete": "", + } ), ) diff --git a/main/models.py b/main/models.py index 2735af40..034e6e6e 100644 --- a/main/models.py +++ b/main/models.py @@ -610,8 +610,9 @@ Odeslání přihlášky selhalo: {errors} """, ) - else: - form = CareerSubmissionForm() + + # Recreate form either way, since we don't want it to be prepopulated with data. + form = CareerSubmissionForm() return render( request, -- GitLab