Skip to content

Commit

Permalink
Utilisation du DSFRForm pour formulaire de recherche
Browse files Browse the repository at this point in the history
  • Loading branch information
alanzirek committed Jun 28, 2024
1 parent 9009a7a commit 5e3e603
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
13 changes: 0 additions & 13 deletions common/mixins.py

This file was deleted.

8 changes: 2 additions & 6 deletions sv/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
Region,
Etat,
)
from common.mixins import DSFRFormMixin
from core.forms import DSFRForm


class FicheDetectionSearchForm(forms.Form, DSFRFormMixin):
class FicheDetectionSearchForm(forms.Form, DSFRForm):
numero = forms.CharField(
label="Numéro",
required=False,
Expand All @@ -54,10 +54,6 @@ class FicheDetectionSearchForm(forms.Form, DSFRFormMixin):
date_fin = forms.DateField(label="Au", widget=forms.DateInput(attrs={"type": "date"}), required=False)
etat = forms.ModelChoiceField(label="État", queryset=Etat.objects.all(), required=False)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.apply_input_form_css_classes()

def clean_numero(self) -> Optional[Union[Tuple[int, int], str]]:
"""Vérifie que le champ 'numero' est au format 'annee.numero' et le retourne sous forme de tuple (annee, numero)."""
numero = self.cleaned_data["numero"]
Expand Down

0 comments on commit 5e3e603

Please sign in to comment.