On trie les lieux de manière plus pratique
This commit is contained in:
@@ -288,7 +288,7 @@
|
||||
},
|
||||
{
|
||||
"com_name": "Clermont-Ferrand",
|
||||
"main": true,
|
||||
"main": 10,
|
||||
"geo_point_2d": {
|
||||
"lon": 3.1153994509459313,
|
||||
"lat": 45.78590931605406
|
||||
@@ -338,7 +338,7 @@
|
||||
},
|
||||
{
|
||||
"com_name": "Riom",
|
||||
"main": true,
|
||||
"main": 3,
|
||||
"geo_point_2d": {
|
||||
"lon": 3.13259085594027,
|
||||
"lat": 45.89435053196184
|
||||
@@ -514,7 +514,7 @@
|
||||
},
|
||||
{
|
||||
"com_name": "Chamali\u00e8res",
|
||||
"main": true,
|
||||
"main": 3,
|
||||
"geo_point_2d": {
|
||||
"lon": 3.061838298868612,
|
||||
"lat": 45.77475946884152
|
||||
@@ -1880,7 +1880,7 @@
|
||||
},
|
||||
{
|
||||
"com_name": "Ambert",
|
||||
"main": true,
|
||||
"main": 5,
|
||||
"geo_point_2d": {
|
||||
"lon": 3.7568846508345506,
|
||||
"lat": 45.55567832104365
|
||||
@@ -1944,7 +1944,7 @@
|
||||
},
|
||||
{
|
||||
"com_name": "Pont-du-Ch\u00e2teau",
|
||||
"main": true,
|
||||
"main": 3,
|
||||
"geo_point_2d": {
|
||||
"lon": 3.2398679745448864,
|
||||
"lat": 45.79820943869307
|
||||
@@ -2022,7 +2022,7 @@
|
||||
},
|
||||
{
|
||||
"com_name": "Issoire",
|
||||
"main": true,
|
||||
"main": 4,
|
||||
"geo_point_2d": {
|
||||
"lon": 3.244722971565402,
|
||||
"lat": 45.54551546108481
|
||||
@@ -2261,7 +2261,7 @@
|
||||
},
|
||||
{
|
||||
"com_name": "Cournon-d'Auvergne",
|
||||
"main": true,
|
||||
"main": 3,
|
||||
"geo_point_2d": {
|
||||
"lon": 3.1863969000308425,
|
||||
"lat": 45.74302062249931
|
||||
@@ -2409,7 +2409,7 @@
|
||||
},
|
||||
{
|
||||
"com_name": "Volvic",
|
||||
"main": true,
|
||||
"main": 4,
|
||||
"geo_point_2d": {
|
||||
"lon": 3.018666916678083,
|
||||
"lat": 45.86824389003399
|
||||
@@ -2543,7 +2543,7 @@
|
||||
},
|
||||
{
|
||||
"com_name": "Thiers",
|
||||
"main": true,
|
||||
"main": 7,
|
||||
"geo_point_2d": {
|
||||
"lon": 3.539565856379042,
|
||||
"lat": 45.861856205367744
|
||||
|
@@ -10,8 +10,11 @@ def run():
|
||||
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]
|
||||
|
||||
# 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.objects.bulk_create(objs, ignore_conflicts=True)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user