Strip and check with empty

This commit is contained in:
PCoder 2021-12-01 13:27:43 +05:30
parent 9871e4ff17
commit b3ac3f9836
1 changed files with 1 additions and 1 deletions

View File

@ -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')