Skip to content

Instantly share code, notes, and snippets.

@bbelderbos
Created July 20, 2020 10:03
Show Gist options
  • Save bbelderbos/c69c057aab07440c9a485e3e9c9ad248 to your computer and use it in GitHub Desktop.
Save bbelderbos/c69c057aab07440c9a485e3e9c9ad248 to your computer and use it in GitHub Desktop.
from django.core.management.base import BaseCommand
# import ORM objects
class Command(BaseCommand):
help = 'help text'
def add_arguments(self, parser):
parser.add_argument(
'--test',
action='store_true',
dest='test',
help='this is a test switch'
)
def handle(self, *args, **options):
test = options['test']
print('my command')
# do stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment