Handle range not found

This commit is contained in:
PCoder 2021-11-25 10:47:57 +05:30
parent 5408046fbb
commit e37a77fe07

View file

@ -401,7 +401,10 @@ def handle_object_dict(object_dict, model_name):
print('Getting mother_range of %s' % object_dict['mother_range'])
if object_dict['mother_range'] == '':
object_dict['mother_range'] = 0
object_dict['mother_range'] = Range.objects.get(id=int(object_dict['mother_range']))
try:
object_dict['mother_range'] = Range.objects.get(id=int(object_dict['mother_range']))
except Range.DoesNotExist as dne:
print(str(dne))
if model_name == 'Keyword':
object_dict['keyword'] = object_dict['keyword_id']
object_dict.pop('keyword_id')