mirror of
https://git.cmoser.eu/tinytools/django-tinywiki.git
synced 2026-02-04 06:06:33 +01:00
2025.12.27 13:23:10 (cachyos.cmoser.eu)
This commit is contained in:
@@ -14,7 +14,7 @@ from ...utils import (
|
|||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = "Export wiki content for an app"
|
help = "Import wiki content for an app"
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
parser.add_argument("file", nargs=1, type=str)
|
parser.add_argument("file", nargs=1, type=str)
|
||||||
@@ -25,7 +25,9 @@ class Command(BaseCommand):
|
|||||||
if not options['file']:
|
if not options['file']:
|
||||||
raise CommandError("No file to import specified")
|
raise CommandError("No file to import specified")
|
||||||
|
|
||||||
file = Path(options['file'][0]).resolve()
|
|
||||||
|
file = Path(options['file']).resolve()
|
||||||
|
print(f"Importing from {file} ...")
|
||||||
|
|
||||||
if not file.exists():
|
if not file.exists():
|
||||||
raise CommandError("File does not exist!")
|
raise CommandError("File does not exist!")
|
||||||
@@ -48,7 +50,6 @@ class Command(BaseCommand):
|
|||||||
except UserModel.DoesNotExist:
|
except UserModel.DoesNotExist:
|
||||||
raise CommandError(f"No user with email {email} exists.")
|
raise CommandError(f"No user with email {email} exists.")
|
||||||
|
|
||||||
|
|
||||||
if zipfile.is_zipfile(file):
|
if zipfile.is_zipfile(file):
|
||||||
with zipfile.ZipFile(file, "r") as zf:
|
with zipfile.ZipFile(file, "r") as zf:
|
||||||
znames = zf.namelist()
|
znames = zf.namelist()
|
||||||
|
|||||||
Reference in New Issue
Block a user