diff --git a/app/management/commands/import.py b/app/management/commands/import.py index 0ba214c..7a98732 100644 --- a/app/management/commands/import.py +++ b/app/management/commands/import.py @@ -1,5 +1,5 @@ import django.db.utils -from django.core.management.base import BaseCommand, CommandError +from django.core.management.base import BaseCommand from django.apps import apps from django.db.utils import IntegrityError @@ -470,18 +470,21 @@ def handle_object_dict(object_dict, model_name, debug=False): object_dict['taxon'] = object_dict['taxon_id'] object_dict.pop('taxon_id') if model_name == 'Person' and 'organization_id' in object_dict: - print("organization_id=%s" % object_dict['organization_id']) + if debug: + print("organization_id=%s" % object_dict['organization_id']) if object_dict['organization_id'] == '' or object_dict['organization_id'] is None: 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']) + if debug: + print('Getting status of %s' % object_dict['status']) if object_dict['status'] == '': object_dict['status'] = 0 object_dict['status'] = PeopleStatus.objects.get(id=int(object_dict['status'])) if 'country_lookup' in object_dict: - print('Getting country of %s' % object_dict['country_lookup']) + if debug: + print('Getting country of %s' % object_dict['country_lookup']) if object_dict['country_lookup'] == '': object_dict['country_lookup'] = 0 object_dict['country'] = Country.objects.get(id=int(object_dict['country_lookup'])) @@ -496,7 +499,8 @@ def handle_object_dict(object_dict, model_name, debug=False): if i in object_dict: object_dict[i] = True if object_dict[i].lower().strip() == 'true' else False if object_dict is None: - print("Object None for %s" % model_name) + if debug: + print("Object None for %s" % model_name) # else: # print(object_dict) if str(object_dict) is not None else "Str object dict is None" return object_dict