mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2024-12-01 09:43:44 +03:00
12 lines
307 B
Python
12 lines
307 B
Python
from akarpov.files.models import BaseFileItem, Folder
|
|
|
|
|
|
def delete_folder(folder: Folder):
|
|
for child in BaseFileItem.objects.filter(parent=folder):
|
|
if not child.is_file:
|
|
delete_folder(child)
|
|
else:
|
|
if child.file:
|
|
child.delete()
|
|
folder.delete()
|