diff --git a/config/forms/baseform.py b/config/forms/baseform.py
index d1d111c7..4f830cf3 100644
--- a/config/forms/baseform.py
+++ b/config/forms/baseform.py
@@ -4,8 +4,6 @@
class SitesFacilesBaseForm(DsfrBaseForm):
# Subclassing the Dsfr base form to set autofocus on the first error found when applicable
- template_name = "dsfr/form_snippet.html"
-
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.set_autofocus_on_first_error()
diff --git a/dashboard/templates/wagtailadmin/account/password_reset/confirm.html b/dashboard/templates/wagtailadmin/account/password_reset/confirm.html
index fb5c3fa3..8f40616b 100644
--- a/dashboard/templates/wagtailadmin/account/password_reset/confirm.html
+++ b/dashboard/templates/wagtailadmin/account/password_reset/confirm.html
@@ -15,7 +15,8 @@
{% translate "Set your new password" %}
diff --git a/dashboard/templates/wagtailadmin/account/password_reset/form.html b/dashboard/templates/wagtailadmin/account/password_reset/form.html
index fb4a5072..7bf952b6 100644
--- a/dashboard/templates/wagtailadmin/account/password_reset/form.html
+++ b/dashboard/templates/wagtailadmin/account/password_reset/form.html
@@ -13,7 +13,7 @@ {% translate "Reset your password" %}
diff --git a/events/forms.py b/events/forms.py
index d5e601f9..457a8093 100644
--- a/events/forms.py
+++ b/events/forms.py
@@ -5,7 +5,7 @@
class EventSearchForm(SitesFacilesBaseForm):
- """Main form for search engine."""
+ """Main form for events page list."""
date_from = forms.DateField(
label=_("From…"),
diff --git a/forms/apps.py b/forms/apps.py
index ec22dd82..e4f47388 100644
--- a/forms/apps.py
+++ b/forms/apps.py
@@ -2,5 +2,5 @@
class FormsConfig(AppConfig):
- default_auto_field = "django.db.models.BigAutoField"
+ default_auto_field = "django.db.models.BigAutoField" # type: ignore
name = "forms"
diff --git a/forms/models.py b/forms/models.py
index 681d5044..b2450885 100644
--- a/forms/models.py
+++ b/forms/models.py
@@ -37,11 +37,13 @@ class Meta:
verbose_name_plural = _("Form fields")
-class SitesFacilesBaseForm(BaseForm):
+class SitesFacilesCustomForm(BaseForm):
"""
A base form that adds the necessary DSFR class on relevant fields
"""
+ template_name = "dsfr/form_snippet.html" # type: ignore
+
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for visible in self.visible_fields():
@@ -63,7 +65,7 @@ def create_datetime_field(self, field, options):
return forms.DateField(**options)
def get_form_class(self):
- return type("WagtailForm", (SitesFacilesBaseForm,), self.formfields)
+ return type("WagtailForm", (SitesFacilesCustomForm,), self.formfields)
class FormPage(AbstractEmailForm):
diff --git a/forms/templates/forms/form_page.html b/forms/templates/forms/form_page.html
index f6a66386..6f19ad80 100644
--- a/forms/templates/forms/form_page.html
+++ b/forms/templates/forms/form_page.html
@@ -18,7 +18,7 @@ {{ page.title }}
{{ page.intro|richtext }}