FilterHistoryForm est un formulaire décent

This commit is contained in:
Ludovic Stephan 2020-09-15 19:40:45 +02:00
parent 2bc97a115c
commit 205dc93f4b

View file

@ -7,6 +7,7 @@ from django.core import validators
from django.core.exceptions import ValidationError
from django.forms import modelformset_factory
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from djconfig.forms import ConfigForm
from gestioncof.models import CofProfile
@ -482,10 +483,23 @@ class KFetConfigForm(ConfigForm):
class FilterHistoryForm(forms.Form):
checkouts = forms.ModelMultipleChoiceField(queryset=Checkout.objects.all())
accounts = forms.ModelMultipleChoiceField(queryset=Account.objects.all())
from_date = forms.DateTimeField(widget=DateTimeWidget)
to_date = forms.DateTimeField(widget=DateTimeWidget)
start = forms.DateTimeField(label=_("De"), widget=DateTimeWidget, required=False)
end = forms.DateTimeField(label=_("À"), widget=DateTimeWidget, required=False)
checkout = forms.ModelChoiceField(
label=_("Caisse"),
queryset=Checkout.objects.all(),
required=False,
empty_label=_("Toutes les caisses"),
)
account = forms.ModelChoiceField(
label=_("Compte"),
queryset=Account.objects.all(),
required=False,
empty_label=_("Tous les comptes"),
)
transfers_only = forms.BooleanField(widget=forms.HiddenInput, required=False)
opes_only = forms.BooleanField(widget=forms.HiddenInput, required=False)
# -----