From 0f3497ce2805a09ac963d319dcbd915142b487da Mon Sep 17 00:00:00 2001 From: PCoder Date: Mon, 22 Nov 2021 19:48:36 +0530 Subject: [PATCH] Set status to PeopleStatus instance --- app/management/commands/import.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/management/commands/import.py b/app/management/commands/import.py index d349006..ca59700 100644 --- a/app/management/commands/import.py +++ b/app/management/commands/import.py @@ -3,6 +3,8 @@ from django.apps import apps from django.db.utils import IntegrityError +from app.models import * + import csv import json @@ -405,6 +407,9 @@ def handle_object_dict(object_dict, model_name): object_dict['organization_id'] = '-1' else: object_dict['organization_id'] = int(float(object_dict['organization_id'])) + if 'status' in object_dict: + print('Getting status of %s' % object_dict['status']) + object_dict['status'] = PeopleStatus.objects.get(int(object_dict['status'])) for i in ['news_letter', 'birds', 'mammals', 'reptiles', 'amphibians', 'fish', 'insects', 'molluscs', 'crustaceans', 'arachnids', 'angiosperms', 'gymnosperms', 'fungi', 'algae', 'microbes', 'biological_field_sampling', 'data_mining', 'remote_sensing',