Ajout d'un filtre par proximité géographique
This commit is contained in:
3259
src/scripts/communes.json
Normal file
3259
src/scripts/communes.json
Normal file
File diff suppressed because it is too large
Load Diff
17
src/scripts/create_reference_locations.py
Normal file
17
src/scripts/create_reference_locations.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import json, os
|
||||
|
||||
from django.contrib.gis.geos import Point
|
||||
|
||||
from agenda_culturel.models import ReferenceLocation
|
||||
|
||||
def run():
|
||||
input_file = os.path.dirname(__file__) + os.path.sep + "communes.json"
|
||||
data = []
|
||||
with open(input_file, 'r') as file:
|
||||
data = json.load(file)
|
||||
|
||||
objs = [ReferenceLocation(location=Point(c["geo_point_2d"]["lon"], c["geo_point_2d"]["lat"]), name=c["com_name"], main="main" in c) for c in data]
|
||||
|
||||
objs = ReferenceLocation.objects.bulk_create(objs, ignore_conflicts=True)
|
||||
|
||||
|
Reference in New Issue
Block a user