MotherRange debug + handle ValueError

This commit is contained in:
PCoder 2021-11-25 13:44:54 +05:30
parent 83ab27c2d3
commit b0923faf88

View file

@ -380,15 +380,16 @@ class Command(BaseCommand):
if mother_range_reload:
# We have loaded the range model already and we are attempting to construct the mother_range
# relationship
print("Mother range relationship")
try:
this_range = Range.objects.get(id=int(row[0]))
r = Range.objects.get(id=int(row[5])) # default Range which exists already
this_range.mother_range = r
this_range.save()
except Range.DoesNotExist as dne:
print("MotherRange")
print("this range = %s, mother range --> %s" % (row[0], row[5]))
print(str(dne))
except ValueError as ve:
print(str(ve))
continue
_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)