[Django]-Python django create own command and add list as parameter

6👍

✅

You only need to specify either nargs='*', to allow 0 or more values, or nargs='+' to allow 1 or more values, eg:

parser.add_argument(
    '--group',
    nargs='*',
    help='set group(s) like "basic", "advanced"',
)

Also, you need to call your command without square brackets or commas:

py manage.py create_app_user --username dustin --password hdf --email "" --group "admin" "basic"

Leave a comment