Pass debug as param
This commit is contained in:
parent
40918e0a70
commit
9871e4ff17
1 changed files with 3 additions and 1 deletions
|
@ -291,6 +291,7 @@ class Command(BaseCommand):
|
|||
parser.add_argument('--app_name', type=str, help="django app name that the model is connected to", default='app')
|
||||
parser.add_argument('--mother_range_reload', action='store_true', help="Whether we are trying to reload mother "
|
||||
"range relationship")
|
||||
parser.add_argument('--debug', action='store_true', help="Whether we want to debug")
|
||||
parser.add_argument('--all', action='store_true', help="Imports all csvs")
|
||||
|
||||
# ./manage.py import --path /home/pcoder/Downloads/gmbadb/csvs/v2-LU_RedListCategories.csv --model_name RedListCategory --app_name app
|
||||
|
@ -306,6 +307,7 @@ class Command(BaseCommand):
|
|||
csv_folder_path = '/home/pcoder/Downloads/gmbadb/csvs'
|
||||
if options['csv_folder_path']:
|
||||
csv_folder_path = options['csv_folder_path']
|
||||
debug = options.get('debug', None)
|
||||
if options.get('all'):
|
||||
print("Doing an import of all csvs")
|
||||
for csv_file_name, model_name in self.csv_files_models_dict.items():
|
||||
|
@ -399,7 +401,7 @@ class Command(BaseCommand):
|
|||
error_row_count += 1
|
||||
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)
|
||||
_object_dict = handle_object_dict(_object_dict, model_name, debug=debug)
|
||||
try:
|
||||
m = _model(**_object_dict)
|
||||
m.save()
|
||||
|
|
Loading…
Add table
Reference in a new issue