diff --git a/app/management/commands/import.py b/app/management/commands/import.py index 30829b1..048b72a 100644 --- a/app/management/commands/import.py +++ b/app/management/commands/import.py @@ -418,7 +418,7 @@ class Command(BaseCommand): print("Total rows = %s, error rows = %s" % (total, error_row_count)) -def handle_object_dict(object_dict, model_name): +def handle_object_dict(object_dict, model_name, debug=False): if model_name == 'Resource': object_dict['url'] = object_dict['url'].strip("#") for i in ['PEGASuS_Check_map_with_author', 'gloria', 'gnomo', 'lter', 'ltser', 'miren', 'team', 'inventory']: @@ -432,12 +432,14 @@ def handle_object_dict(object_dict, model_name): for f in connected_fields: for k, v in f.items(): if k in object_dict: - print('Getting %s of %s' % (k, object_dict[k])) + if debug: + print('Getting %s of %s' % (k, object_dict[k])) if object_dict[k] == '': object_dict[k] = 0 object_dict[k] = v.objects.get(id=int(object_dict[k])) if 'mother_range' in object_dict: - print('Getting mother_range of %s' % object_dict['mother_range']) + if debug: + print('Getting mother_range of %s' % object_dict['mother_range']) if object_dict['mother_range'] == '': object_dict['mother_range'] = 0 try: