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

[YC-1171] set validation for geom field #1005

Merged
merged 1 commit into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading