Skip to content

Commit f0d77af

Browse files
joemullStephDriver
authored andcommitted
feat #4978 Add confirmation to commands that rewrite journal_defaults.json
1 parent 0fc1837 commit f0d77af

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/utils/management/commands/update_defaults.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ def handle(self, *args, **options):
4343
:param options: None
4444
:return: None
4545
"""
46+
confirmation = input(
47+
"journal_defaults.json will be rewritten with values from the database. OK? (y/n)".lower()
48+
)
49+
if confirmation != "y":
50+
return
51+
4652
translation.activate("en")
4753
journal_code = options.get("journal_code", None)
4854
group_name = options.get("group_name", None)

src/utils/management/commands/update_defaults_json.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ def handle(self, *args, **options):
2020
:param options: None
2121
:return: None
2222
"""
23+
confirmation = input(
24+
"journal_defaults.json will be rewritten. OK? (y/n)".lower()
25+
)
26+
if confirmation != "y":
27+
return
28+
2329
with codecs.open(
2430
os.path.join(settings.BASE_DIR, "utils/install/journal_defaults.json"),
2531
encoding="utf-8",

0 commit comments

Comments
 (0)