Ajout de suggestions de filtres par ville

This commit is contained in:
Jean-Marie Favreau
2024-11-27 19:57:39 +01:00
parent 8ef620c8e1
commit 65430a2a8f
9 changed files with 77 additions and 6 deletions

View File

@@ -289,6 +289,7 @@
{
"com_name": "Clermont-Ferrand",
"main": 10,
"suggested": 10,
"geo_point_2d": {
"lon": 3.1153994509459313,
"lat": 45.78590931605406
@@ -339,6 +340,7 @@
{
"com_name": "Riom",
"main": 3,
"suggested": 10,
"geo_point_2d": {
"lon": 3.13259085594027,
"lat": 45.89435053196184

View File

@@ -13,7 +13,10 @@ def run():
# remove all locations
ReferenceLocation.objects.all().delete()
objs = [ReferenceLocation(location=Point(c["geo_point_2d"]["lon"], c["geo_point_2d"]["lat"]), name=c["com_name"], main=c["main"] if "main" in c else 0) for c in data]
objs = [ReferenceLocation(location=Point(c["geo_point_2d"]["lon"], c["geo_point_2d"]["lat"]),
name=c["com_name"],
main=c["main"] if "main" in c else 0,
suggested_distance=c["suggested"] if "suggested" in c else None) for c in data]
objs = ReferenceLocation.objects.bulk_create(objs, ignore_conflicts=True)