Add: import from subfolders
This commit is contained in:
parent
90a6b3d32b
commit
0072b8dfbd
1 changed files with 5 additions and 4 deletions
|
@ -53,10 +53,11 @@ class Command(BaseCommand):
|
||||||
tqdm.write(self.style.ERROR(f"The folder '{folder_path}' does not exist."))
|
tqdm.write(self.style.ERROR(f"The folder '{folder_path}' does not exist."))
|
||||||
return
|
return
|
||||||
|
|
||||||
for file_name in tqdm(os.listdir(folder_path), dynamic_ncols=True):
|
for root, dirs, files in tqdm(os.walk(folder_path), dynamic_ncols=True):
|
||||||
if file_name.endswith('.json'):
|
for file_name in files:
|
||||||
file_path = os.path.join(folder_path, file_name)
|
if file_name.endswith('.json'):
|
||||||
self.process_json_file(file_path)
|
file_path = os.path.join(root, file_name)
|
||||||
|
self.process_json_file(file_path)
|
||||||
|
|
||||||
|
|
||||||
def import_data(self, data, json_file_path):
|
def import_data(self, data, json_file_path):
|
||||||
|
|
Loading…
Reference in a new issue