mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-24 16:21:53 +00:00
37 lines
988 B
Python
37 lines
988 B
Python
|
|
from django.core.management.base import BaseCommand
|
|
|
|
|
|
"""this is now replaced by databaseRest.py
|
|
|
|
This is an example of how to create our own bespoke commandline
|
|
commands.
|
|
|
|
Good articles on creating Django commands at
|
|
https://www.mattlayman.com/understand-django/command-apps/
|
|
https://www.geeksforgeeks.org/custom-django-management-commands/
|
|
|
|
Django docs:
|
|
https://docs.djangoproject.com/en/dev/howto/custom-management-commands/
|
|
|
|
We might use this mechanism to replace/enhance the
|
|
folk, wallets and any cron jobs or other standalone scripts.
|
|
"""
|
|
|
|
|
|
class Command(BaseCommand):
|
|
def add_arguments(self, parser):
|
|
# Positional arguments
|
|
parser.add_argument("posargs", nargs="+", type=int)
|
|
|
|
# Named (optional) arguments
|
|
parser.add_argument(
|
|
"--delete",
|
|
action="store_true",
|
|
help="Removed as redundant - use databaseReset.py",
|
|
)
|
|
|
|
def handle(self, *args, **options):
|
|
print(args)
|
|
print(options)
|