Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
set validation for geom field
Browse files Browse the repository at this point in the history
  • Loading branch information
monodo committed May 28, 2024
1 parent 507736b commit b24fc3c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions geocity/apps/forms/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,22 @@ def clean_maximum_date(self):

return maximum_date

def clean_map_widget_configuration(self):
selected_input_type = self.cleaned_data.get("input_type")
map_widget_configuration = self.cleaned_data.get("map_widget_configuration")

if (
selected_input_type == models.Field.INPUT_TYPE_GEOM
and not map_widget_configuration
):
raise forms.ValidationError(
_(
"Vous devez obligatoirement sélectionner une configuration de carte avancée."
)
)

return map_widget_configuration

class Media:
js = ("js/admin/form_field.js",)

Expand Down

0 comments on commit b24fc3c

Please sign in to comment.