fix json import

This commit is contained in:
Pierre-antoine Comby 2020-05-25 01:15:08 +02:00
parent f367b0ab2a
commit 3a636ce189
1 changed files with 2 additions and 3 deletions

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):