It is straight forward creating a string parameter such as --test_email_address
below.
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--test_email_address',
action='store',
type="string",
dest='test_email_address',
help="Specifies test email address."),
make_option('--vpds',
action='store',
type='list', /// ??? Throws exception
dest='vpds',
help="vpds list [,]"),
)
But how can I define a list to be passed in? such as [1, 3, 5]
list
- without the quotes ? From the documentation, it looks liketype
can be any valid simple types. The other (hacky) way is to read the arguments as string, and parse it usingast.literal_eval
or something. – Cursive