Replaces optparse with argparse for commands

This commit is contained in:
Ilan Steemers
2016-06-07 16:43:51 +02:00
parent 67bd68d10f
commit d58c31e103
3 changed files with 24 additions and 28 deletions
+8 -9
View File
@@ -1,5 +1,3 @@
from optparse import make_option
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext as _
@@ -10,13 +8,14 @@ class Command(BaseCommand):
# Translators: help text for qcluster management command
help = _("Starts a Django Q Cluster.")
option_list = BaseCommand.option_list + (
make_option('--run-once',
action='store_true',
dest='run_once',
default=False,
help='Run once and then stop.'),
)
def add_arguments(self, parser):
parser.add_argument(
'--run-once',
action='store_true',
dest='run_once',
default=False,
help='Run once and then stop.',
)
def handle(self, *args, **options):
q = Cluster()