[Fixed]-How to create label_command ind django1.10

1👍

For me the following worked: change

parser.add_argument('filename', nargs='+', type=str)

to

parser.add_argument('args', metavar=self.label, nargs='+')

a line which I copied directly django/django/core/management/base.py when fixing my LabelCommands when migrating from 1.7 to 1.10.7.

Although what you might want to do is to add substitute the line above with

super(Command, self).add_arguments(parser)

to maintain forwards compatibility.

👤7mp

Leave a comment