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

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add shot urls for forms
Browse files Browse the repository at this point in the history
monodo committed Nov 8, 2023
1 parent 4888e6e commit 4b7dfdb
Showing 2 changed files with 110 additions and 9 deletions.
8 changes: 6 additions & 2 deletions geocity/apps/submissions/management/commands/fixturize.py
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
from geocity.apps.submissions.models import *

# import fixturize file
from ..fixturize_data.fixturize import *
from ..fixturize_data.demo_example import *


def strip_accents(text):
@@ -255,7 +255,9 @@ def setup_form_and_form_categories(
form_category_obj = self.create_form_category(
form_category_name, integrator_group
)
self.create_contact_form(form_category_obj, integrator_group)

if not form_category.startswith("ADVANCED_MAP_PLUGIN"):
self.create_contact_form(form_category_obj, integrator_group)

for form, *fields in objs:
form_obj, form_order = self.create_form(
@@ -306,6 +308,7 @@ def create_form(

form_obj = Form.objects.create(
name=form,
quick_access_slug=f"{convert_string_to_api_key(form)}_{convert_string_to_api_key(administrative_entity.name)}",
api_name=convert_string_to_api_key(form),
category=form_category_obj,
is_public=True,
@@ -368,6 +371,7 @@ def setup_form_specific_cases(self, form_category):
configuration=advanced_map_config,
)
geo_widget_option = Form.GEO_WIDGET_ADVANCED
needs_date = False

result = {
"has_geometry_point": has_geometry_point,
111 changes: 104 additions & 7 deletions geocity/apps/submissions/management/fixturize_data/demo_example.py
Original file line number Diff line number Diff line change
@@ -2,10 +2,10 @@

# Defines the number of each type of user to create on each entity
iterations = {
"integrator_iterations": 2,
"pilot_iterations": 3,
"validator_iterations": 3,
"user_iterations": 3,
"integrator_iterations": 1,
"pilot_iterations": 1,
"validator_iterations": 1,
"user_iterations": 1,
}

# domain:entity
@@ -16,9 +16,8 @@
# - ENTITY-validator-ITERATION
# - ENTITY-user-ITERATION
entities = {
"ca.ch": "Commune-a",
"cb.ch": "Commune-b",
"pc.ch": "Participation citoyenne ",
"ca.ch": "Yverdon-les-Bains",
"cb.ch": "Vevey",
}

# Geometries for the entities
@@ -70,6 +69,7 @@
"input_type": "address",
"placeholder": "Place Pestalozzi 2, 1400 Yverdon-les-Bains",
"is_mandatory": False,
"additional_searchtext_for_address_field": "Yverdon-les-Bains",
}
field_adresse_geocode = {
"name": "Adresse avec géocodage",
@@ -100,6 +100,11 @@
"is_mandatory": False,
"choices": "Déviation trafic\nHoraire prolongé\nSon>90dB",
}
field_file = {
"name": "Fichier",
"input_type": "file",
"is_mandatory": False,
}

# Define form_categories for each entity
# To create specific cases add in front of category name :
@@ -114,6 +119,7 @@
"Signaler un problème sur un lampadaire",
field_comment,
field_date,
field_file,
),
],
),
@@ -124,6 +130,7 @@
"Demande de macaron",
field_comment,
field_date,
field_file,
),
(
"Accès au centre-ville historique",
@@ -135,6 +142,7 @@
field_checkbox,
field_adresse,
field_list_multiple,
field_file,
),
],
),
@@ -151,6 +159,7 @@
field_checkbox,
field_adresse,
field_list_multiple,
field_file,
),
(
"Événement culturel",
@@ -162,6 +171,7 @@
field_checkbox,
field_adresse,
field_list_multiple,
field_file,
),
(
"Événement politique",
@@ -173,6 +183,7 @@
field_checkbox,
field_adresse,
field_list_multiple,
field_file,
),
(
"Événement commercial",
@@ -184,6 +195,7 @@
field_checkbox,
field_adresse,
field_list_multiple,
field_file,
),
],
),
@@ -200,6 +212,7 @@
field_adresse_geocode,
field_checkbox,
field_list_single,
field_file,
),
(
"Permis de dépôt",
@@ -210,6 +223,7 @@
field_adresse,
field_adresse_geocode,
field_checkbox,
field_file,
),
],
),
@@ -219,10 +233,12 @@
(
"Prime éco-mobilité",
field_comment,
field_file,
),
(
"Abonnement de bus",
field_comment,
field_file,
),
],
),
@@ -239,3 +255,84 @@
of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to
those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases
are perfectly simple and easy to distinguish."""

# Advanced map config example

advanced_map_config = {
"wfs": {
"url": "https://mapnv.ch/mapserv_proxy?ogcserver=source+for+image%2Fpng&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=ELE_tragwerk_gesco"
},
"mode": {"type": "mix"},
"wmts": [
{
"name": "",
"layer": "ch.swisstopo.swissimage",
"thumbnail": "/static/images/aerial.svg",
"capability": "https://wmts.geo.admin.ch/EPSG/2056/1.0.0/WMTSCapabilities.xml",
"projection": "EPSG:2056",
}
],
"zoom": 15,
"border": {
"url": "",
"notification": "Veuillez placer votre élément dans les limites autorisées",
},
"search": {
"displaySearch": True,
"bboxRestiction": "",
"requestWithoutCustomValue": "https://api3.geo.admin.ch/rest/services/api/SearchServer?limit=5&&type=locations&sr=2056&lang=fr&origins=address%2Cparcel",
},
"cluster": {"distance": 40, "minDistance": 35},
"maxZoom": 20,
"minZoom": 1,
"information": {"title": "Signaler ...", "content": "", "duration": 5000},
"interaction": {
"fullscreen": True,
"displayZoom": True,
"enableRotation": True,
"displayScaleLine": False,
"enableGeolocation": True,
"enableCenterButton": True,
},
"outputFormat": "GeometryCollection",
"defaultCenter": [2539057, 1181111],
"inclusionArea": {"url": "", "filter": ""},
"notifications": [
{
"rule": {
"type": "ZOOM_CONSTRAINT",
"minZoom": 16,
"maxElement": None,
"couldBypass": None,
},
"type": "warning",
"message": "Veuillez zoomer davantage avant de pouvoir sélectionner un emplacement.",
},
{
"rule": {
"type": "MAX_SELECTION",
"minZoom": None,
"maxElement": 1,
"couldBypass": None,
},
"type": "warning",
"message": "Le maximum de sélection est limité à {x}.",
},
{
"rule": {
"type": "INFORMATION",
"minZoom": None,
"maxElement": None,
"couldBypass": None,
},
"type": "info",
"message": "Sélectionnez un marqueur ou cliquez longuement sur la carte pour qu’un élément soit créé.",
},
],
"geolocationInformation": {
"displayBox": True,
"currentLocation": False,
"reverseLocation": True,
},
"selectionTargetBoxMessage": "",
}

0 comments on commit 4b7dfdb

Please sign in to comment.