From 16146deb2e76bb77f9566e0c3d5f21fd98d0f65c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 9 May 2025 10:41:44 +0200 Subject: ✨ GIS API: manage GIS connections (list, request token, create token, delete) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/forms_common.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'ishtar_common/forms_common.py') diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 757e3dc85..007be5fe0 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -3481,3 +3481,17 @@ class PreGISForm(IshtarForm): self.fields["back_url"] = forms.CharField( label="", required=False, widget=forms.HiddenInput, initial=back_url ) + + +class GisRequestForm(IshtarForm): + access_type = forms.ChoiceField( + label=_("New access type"), choices=models_rest.API_ACCESS_TYPES + ) + name = forms.CharField(label=_("Name"), max_length=150) + limit_date = DateField(label=_("Limit date"), required=False) + + def clean(self): + data = self.cleaned_data + if data.get("limit_date", None) and data["limit_date"] < datetime.date.today(): + raise forms.ValidationError(_("Limit date cannot be in the past.")) + return data -- cgit v1.2.3