Print debug messages while import

This commit is contained in:
PCoder 2021-11-29 09:14:13 +05:30
parent f1eaedbd14
commit 1460664145

View file

@ -1,3 +1,4 @@
import django.db.utils
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.apps import apps from django.apps import apps
@ -401,7 +402,14 @@ class Command(BaseCommand):
try: try:
m = _model(**_object_dict) m = _model(**_object_dict)
m.save() m.save()
except django.db.utils.IntegrityError as ex1:
error_row_count += 1
print(str(ex1))
print("**********************")
print(str(_object_dict))
print("**********************")
except Exception as ex: except Exception as ex:
error_row_count += 1
print('-----') print('-----')
print(str(ex)) print(str(ex))
print('----------------') print('----------------')