Skip to content

Commit

Permalink
fixing import lookup values task
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Aug 28, 2020
1 parent d27f0a8 commit 40ef20e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/common/management/commands/import_lookup_values.py
Expand Up @@ -22,7 +22,6 @@ def handle(self, *args, **options):
user = UserProfile.objects.filter(username='ocladmin').get()
org = Organization.objects.get(mnemonic='OCL')
sources = self.create_sources(org, user)
created = False

current_path = os.path.dirname(__file__)
importer_confs = [
Expand Down Expand Up @@ -86,6 +85,7 @@ def create_sources(org, user):
def create_concepts(source, file, user):
file = open(file, 'r')
lines = file.readlines()
created = False
for line in lines:
data = json.loads(line)
mnemonic = data.pop('id', None)
Expand All @@ -94,4 +94,6 @@ def create_concepts(source, file, user):
data['name'] = mnemonic
data['parent'] = source
Concept.persist_new(data, user, False)
return True
if not created:
created = True
return created

0 comments on commit 40ef20e

Please sign in to comment.