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

Commit 2eacf14

Browse files
authored
set validation for geom field (#1005)
1 parent a6ab80d commit 2eacf14

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

geocity/apps/forms/admin.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,22 @@ def clean_maximum_date(self):
556556

557557
return maximum_date
558558

559+
def clean_map_widget_configuration(self):
560+
selected_input_type = self.cleaned_data.get("input_type")
561+
map_widget_configuration = self.cleaned_data.get("map_widget_configuration")
562+
563+
if (
564+
selected_input_type == models.Field.INPUT_TYPE_GEOM
565+
and not map_widget_configuration
566+
):
567+
raise forms.ValidationError(
568+
_(
569+
"Vous devez obligatoirement sélectionner une configuration de carte avancée."
570+
)
571+
)
572+
573+
return map_widget_configuration
574+
559575
class Media:
560576
js = ("js/admin/form_field.js",)
561577

0 commit comments

Comments
 (0)