Django 1.10: Use add_argument for options in BaseCommand.

This commit is contained in:
Umair Khan
2016-11-03 14:22:19 +05:00
committed by Tim Abbott
parent d3a4fa3e94
commit 682aa1f298
18 changed files with 284 additions and 240 deletions

View File

@@ -9,7 +9,7 @@ from optparse import make_option
from django.test import Client
from django.conf import settings
from django.core.management.base import BaseCommand
from django.core.management.base import BaseCommand, CommandParser
class Command(BaseCommand):
@@ -22,16 +22,19 @@ Example:
"""
option_list = BaseCommand.option_list + (
make_option('-f', '--fixture',
dest='fixture',
type='str',
help='The path to the fixture you\'d like to send into Zulip'),
make_option('-u', '--url',
dest='url',
type='str',
help='The url on your Zulip server that you want to post the fixture to'),
)
def add_arguments(self, parser):
# type: (CommandParser) -> None
parser.add_argument('-f', '--fixture',
dest='fixture',
type=str,
help='The path to the fixture you\'d like to send '
'into Zulip')
parser.add_argument('-u', '--url',
dest='url',
type=str,
help='The url on your Zulip server that you want '
'to post the fixture to')
def handle(self, **options):
# type: (*Any, **str) -> None