Changed the safe-guard condition of the accounting_sample command in the accounting application.
This commit is contained in:
parent
2ae1e825f6
commit
65a950a28a
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
import random
|
import random
|
||||||
|
import sys
|
||||||
|
|
||||||
from django.core.management import BaseCommand, CommandParser
|
from django.core.management import BaseCommand, CommandParser
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
@ -47,8 +48,9 @@ class Command(BaseCommand):
|
|||||||
*args (list[str]): The command line arguments.
|
*args (list[str]): The command line arguments.
|
||||||
**options (dict[str,str]): The command line switches.
|
**options (dict[str,str]): The command line switches.
|
||||||
"""
|
"""
|
||||||
print("This may mess up your data. Continue? [Y/N] ", end="")
|
if User.objects.first() is not None:
|
||||||
if input().lower() not in ("y", "yes"):
|
print("Refused to fill in sample data with existing data.",
|
||||||
|
file=sys.stderr)
|
||||||
return
|
return
|
||||||
|
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
Loading…
Reference in New Issue
Block a user