Accomodate mother field in import also
This commit is contained in:
parent
0a3ea6a455
commit
6770a5a200
1 changed files with 6 additions and 0 deletions
|
@ -463,6 +463,12 @@ def handle_object_dict(object_dict, model_name, debug=False):
|
||||||
object_dict['keyword'] = Keyword.objects.get(keyword_id=0) # default Keyword which exists already
|
object_dict['keyword'] = Keyword.objects.get(keyword_id=0) # default Keyword which exists already
|
||||||
except Keyword.DoesNotExist as dne:
|
except Keyword.DoesNotExist as dne:
|
||||||
print(str(dne))
|
print(str(dne))
|
||||||
|
if object_dict['mother'] == '':
|
||||||
|
object_dict['mother'] = 0
|
||||||
|
try:
|
||||||
|
object_dict['mother'] = Keyword.objects.get(keyword_id=object_dict['mother']) # default Keyword which exists already
|
||||||
|
except Keyword.DoesNotExist as dne:
|
||||||
|
print(str(dne))
|
||||||
if model_name == 'Organization' and 'country_id' in object_dict:
|
if model_name == 'Organization' and 'country_id' in object_dict:
|
||||||
object_dict['country'] = object_dict['country_id']
|
object_dict['country'] = object_dict['country_id']
|
||||||
object_dict.pop('country_id')
|
object_dict.pop('country_id')
|
||||||
|
|
Loading…
Reference in a new issue