Commit 26d62923 authored by Pierre Arnaud's avatar Pierre Arnaud

Add PTU in territories-local result

parent 69fdcb7a
......@@ -357,6 +357,7 @@ def territories(request):
full_name_and_cp = json_get_territoire_info['data']['main_postal_distribution'] + ' (' + json_get_territoire_info['data']['type_name'] + ')'
else:
return error
ptu_name = ""
for el in json_get_territoire_info["data"]["ancestors_kind_code"]:
if el["kind"] == "Country":
......@@ -369,6 +370,8 @@ def territories(request):
department_data = requests.get(url, params=dict(kind="DepartmentOfFrance", code=el["code"])).json()["data"]
department_name = department_data["full_name"]
department_fullname = department_data['main_postal_distribution'] + ' (' + department_data['type_name'] + ')'
elif el["kind"] == "UrbanTransportsPerimeterOfFrance":
ptu_name = el["kind"]
# Get territory's service infos
url = '{}/poi/search'.format(petitpois_api)
......@@ -449,7 +452,8 @@ def territories(request):
if full_name_and_cp in territories \
or department_fullname in territories \
or region_fullname in territories \
or name == 'france' or name == 'france-metropolitaine':
or name == 'france' or name == 'france-metropolitaine' \
or ptu_name:
if el.get("multimodal") == 1:
parse_result["multimodal"].append(el)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment