From b3ac3f98360acad2dedecd6bff51e805f9b13cff Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 1 Dec 2021 13:27:43 +0530 Subject: [PATCH] Strip and check with empty --- app/management/commands/import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/management/commands/import.py b/app/management/commands/import.py index fa3817d..ed6305c 100644 --- a/app/management/commands/import.py +++ b/app/management/commands/import.py @@ -492,7 +492,7 @@ def handle_object_dict(object_dict, model_name, debug=False): if 'country_lookup' in object_dict: if debug: print('Getting country of %s' % object_dict['country_lookup']) - if object_dict['country_lookup'] == '': + if object_dict['country_lookup'].strip() == '' or object_dict['country_lookup'] is None: object_dict['country_lookup'] = 0 object_dict['country'] = Country.objects.get(id=int(object_dict['country_lookup'])) object_dict.pop('country_lookup')