MotherRange debug + handle ValueError
This commit is contained in:
parent
83ab27c2d3
commit
b0923faf88
1 changed files with 3 additions and 2 deletions
|
@ -380,15 +380,16 @@ class Command(BaseCommand):
|
||||||
if mother_range_reload:
|
if mother_range_reload:
|
||||||
# We have loaded the range model already and we are attempting to construct the mother_range
|
# We have loaded the range model already and we are attempting to construct the mother_range
|
||||||
# relationship
|
# relationship
|
||||||
print("Mother range relationship")
|
|
||||||
try:
|
try:
|
||||||
this_range = Range.objects.get(id=int(row[0]))
|
this_range = Range.objects.get(id=int(row[0]))
|
||||||
r = Range.objects.get(id=int(row[5])) # default Range which exists already
|
r = Range.objects.get(id=int(row[5])) # default Range which exists already
|
||||||
this_range.mother_range = r
|
this_range.mother_range = r
|
||||||
this_range.save()
|
this_range.save()
|
||||||
except Range.DoesNotExist as dne:
|
except Range.DoesNotExist as dne:
|
||||||
print("MotherRange")
|
print("this range = %s, mother range --> %s" % (row[0], row[5]))
|
||||||
print(str(dne))
|
print(str(dne))
|
||||||
|
except ValueError as ve:
|
||||||
|
print(str(ve))
|
||||||
continue
|
continue
|
||||||
_object_dict = {self.cols_to_django_fields.get(key): value.lstrip('"').rstrip('"') for key, value in zip(header, row)}
|
_object_dict = {self.cols_to_django_fields.get(key): value.lstrip('"').rstrip('"') for key, value in zip(header, row)}
|
||||||
_object_dict = handle_object_dict(_object_dict, model_name)
|
_object_dict = handle_object_dict(_object_dict, model_name)
|
||||||
|
|
Loading…
Reference in a new issue