1
0
mirror of https://gitlab.crans.org/bde/nk20-scripts synced 2024-12-26 17:32:23 +00:00

fix json import

This commit is contained in:
Pierre-antoine Comby 2020-05-25 01:15:08 +02:00
parent f367b0ab2a
commit 3a636ce189

View File

@ -5,7 +5,6 @@ import time
from collections import defaultdict
from django.core.management.base import BaseCommand
from collections import defaultdict
from django.apps import apps
from django.db import transaction
@ -61,8 +60,8 @@ class ImportCommand(BaseCommand):
json.dump(self.MAP_IDBDE, fp, sort_keys=True, indent=2)
def load_map(self, filename):
with open(filename, 'w') as fp:
self.MAP_IDBDE = json.load(fp)
with open(filename, 'r') as fp:
self.MAP_IDBDE = json.load(fp, object_hook=lambda d: {int(k): int(v) for k, v in d.items()})
class BulkCreateManager(object):