Handle range not found
This commit is contained in:
parent
5408046fbb
commit
e37a77fe07
1 changed files with 4 additions and 1 deletions
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue