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