diff --git a/itou/common_apps/address/departments.py b/itou/common_apps/address/departments.py index 58692781beb..9cc13b6fec8 100644 --- a/itou/common_apps/address/departments.py +++ b/itou/common_apps/address/departments.py @@ -155,6 +155,106 @@ def get_department_to_region(): "75": {"city": "Paris", "max": 75020}, } +# https://gist.github.com/sunny/13803?permalink_comment_id=4216753#gistcomment-4216753 +DEPARTMENTS_ADJACENCY = { + "01": ("38", "39", "69", "71", "73", "74"), + "02": ("08", "51", "59", "60", "77", "80"), + "03": ("18", "23", "42", "58", "63", "71"), + "04": ("05", "06", "13", "26", "83", "84"), + "05": ("04", "26", "38", "73"), + "06": ("04", "83"), + "07": ("26", "30", "38", "42", "43", "48", "84"), + "08": ("02", "51", "55"), + "09": ("11", "31", "66"), + "10": ("21", "51", "52", "77", "89"), + "11": ("09", "31", "34", "66", "81"), + "12": ("15", "30", "34", "46", "48", "81", "82"), + "13": ("04", "30", "83", "84"), + "14": ("27", "50", "61", "76"), + "15": ("12", "19", "43", "46", "48", "63"), + "16": ("17", "24", "79", "86", "87"), + "17": ("16", "24", "33", "79", "85"), + "18": ("03", "23", "36", "41", "45", "58"), + "19": ("15", "23", "24", "46", "63", "87"), + "2A": ("2B"), + "2B": ("2A"), + "21": ("10", "39", "52", "58", "70", "71", "89"), + "22": ("29", "35", "56"), + "23": ("03", "18", "19", "36", "63", "87"), + "24": ("16", "17", "19", "33", "46", "47", "87"), + "25": ("39", "70", "90"), + "26": ("04", "05", "07", "38", "84"), + "27": ("14", "28", "60", "61", "76", "78", "95"), + "28": ("27", "41", "45", "61", "72", "78", "91"), + "29": ("22", "56"), + "30": ("07", "12", "13", "34", "48", "84"), + "31": ("09", "11", "32", "65", "81", "82"), + "32": ("31", "40", "47", "64", "65", "82"), + "33": ("17", "24", "40", "47"), + "34": ("11", "12", "30", "81"), + "35": ("22", "44", "49", "50", "53", "56"), + "36": ("18", "23", "37", "41", "86", "87"), + "37": ("36", "41", "49", "72", "86"), + "38": ("01", "05", "07", "26", "42", "69", "73"), + "39": ("01", "21", "25", "70", "71"), + "40": ("32", "33", "47", "64"), + "41": ("18", "28", "36", "37", "45", "72"), + "42": ("03", "07", "38", "43", "63", "69", "71"), + "43": ("07", "15", "42", "48", "63"), + "44": ("35", "49", "56", "85"), + "45": ("18", "28", "41", "58", "77", "89", "91"), + "46": ("12", "15", "19", "24", "47", "82"), + "47": ("24", "32", "33", "40", "46", "82"), + "48": ("07", "12", "15", "30", "43"), + "49": ("35", "37", "44", "53", "72", "79", "85", "86"), + "50": ("14", "35", "53", "61"), + "51": ("02", "08", "10", "52", "55", "77"), + "52": ("10", "21", "51", "55", "70", "88"), + "53": ("35", "49", "50", "61", "72"), + "54": ("55", "57", "67", "88"), + "55": ("08", "51", "52", "54", "88"), + "56": ("22", "29", "35", "44"), + "57": ("54", "67"), + "58": ("03", "18", "21", "45", "71", "89"), + "59": ("02", "62", "80"), + "60": ("02", "27", "76", "77", "80", "95"), + "61": ("14", "27", "28", "50", "53", "72"), + "62": ("59", "80"), + "63": ("03", "15", "19", "23", "42", "43"), + "64": ("32", "40", "65"), + "65": ("31", "32", "64"), + "66": ("09", "11"), + "67": ("54", "57", "68", "88"), + "68": ("67", "88", "90"), + "69": ("01", "38", "42", "71"), + "70": ("21", "25", "39", "52", "88", "90"), + "71": ("01", "03", "21", "39", "42", "58", "69"), + "72": ("28", "37", "41", "49", "53", "61"), + "73": ("01", "05", "38", "74"), + "74": ("01", "73"), + "75": ("92", "93", "94"), + "76": ("14", "27", "60", "80"), + "77": ("02", "10", "45", "51", "60", "89", "91", "93", "94", "95"), + "78": ("27", "28", "91", "92", "95"), + "79": ("16", "17", "49", "85", "86"), + "80": ("02", "59", "60", "62", "76"), + "81": ("11", "12", "31", "34", "82"), + "82": ("12", "31", "32", "46", "47", "81"), + "83": ("04", "06", "13", "84"), + "84": ("04", "07", "13", "26", "30", "83"), + "85": ("17", "44", "49", "79"), + "86": ("16", "36", "37", "49", "79", "87"), + "87": ("16", "19", "23", "24", "36", "86"), + "88": ("52", "54", "55", "67", "68", "70", "90"), + "89": ("10", "21", "45", "58", "77"), + "90": ("25", "68", "70", "88"), + "91": ("28", "45", "77", "78", "92", "94"), + "92": ("75", "78", "91", "93", "94", "95"), + "93": ("75", "77", "92", "94", "95"), + "94": ("75", "77", "91", "92", "93"), + "95": ("27", "60", "77", "78", "92", "93"), +} + def department_from_postcode(post_code): """ diff --git a/itou/templates/search/includes/siaes_search_filters_departments.html b/itou/templates/search/includes/siaes_search_filters_departments.html index 23d3c20014f..a6d915ff324 100644 --- a/itou/templates/search/includes/siaes_search_filters_departments.html +++ b/itou/templates/search/includes/siaes_search_filters_departments.html @@ -1,79 +1,78 @@ {% load django_bootstrap5 %} -
- {% if form.departments %} -
-
-
- - {{ form.departments.label | capfirst }} - -
- {{ form.departments }} -
+ +{% if form.departments %} +
+
+
+ + {{ form.departments.label | capfirst }} + +
+ {{ form.departments }}
-
- {% endif %} +
+
+{% endif %} - {# getattr and list still painful in Django template #} - {% if form.districts_13 %} -
-
-
- - {{ form.districts_13.label | capfirst }} - -
- {{ form.districts_13 }} -
+{# getattr and list still painful in Django template #} +{% if form.districts_13 %} +
+
+
+ + {{ form.districts_13.label | capfirst }} + +
+ {{ form.districts_13 }}
-
- {% endif %} +
+
+{% endif %} - {% if form.districts_69 %} -
-
-
- - {{ form.districts_69.label | capfirst }} - -
- {{ form.districts_69 }} -
+{% if form.districts_69 %} +
+
+
+ + {{ form.districts_69.label | capfirst }} + +
+ {{ form.districts_69 }}
-
- {% endif %} +
+
+{% endif %} - {% if form.districts_75 %} -
-
-
- - {{ form.districts_75.label | capfirst }} - -
- {{ form.districts_75 }} -
+{% if form.districts_75 %} +
+
+
+ + {{ form.districts_75.label | capfirst }} + +
+ {{ form.districts_75 }}
-
- {% endif %} -
+
+ +{% endif %} diff --git a/itou/templates/search/includes/siaes_search_results.html b/itou/templates/search/includes/siaes_search_results.html index 9db8049737f..396774b0e27 100644 --- a/itou/templates/search/includes/siaes_search_results.html +++ b/itou/templates/search/includes/siaes_search_results.html @@ -21,7 +21,6 @@ - Les emplois de l'inclusion {% include "search/includes/siaes_search_filters_company.html" %} - {% include "search/includes/siaes_search_filters_departments.html" %} {% include "search/includes/siaes_search_top.html" %} {% include "search/includes/siaes_search_tabs.html" %} {% endif %} diff --git a/itou/templates/search/siaes_search_results.html b/itou/templates/search/siaes_search_results.html index b08fcc2b82c..da94c54a3c9 100644 --- a/itou/templates/search/siaes_search_results.html +++ b/itou/templates/search/siaes_search_results.html @@ -17,13 +17,15 @@
- {% include "search/includes/siaes_search_form.html" with form=form is_home=False only %} +
+ {% include "search/includes/siaes_search_form.html" with form=form is_home=False only %} +
{% include "search/includes/siaes_search_tabs.html" %}
{% include "search/includes/siaes_search_top.html" %}