diff options
| author | mentix02 <manan.yadav02@gmail.com> | 2019-05-10 18:01:49 +0530 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-05-20 10:44:34 +0200 |
| commit | da10b647f765328c2061f5a63cd3ebe14a573fd5 (patch) | |
| tree | 47ff67dbfe6bf8aab805841a073d59060e5a1ee4 /docs | |
| parent | 3d4e53bcb1f94e451f291e832bfa668361cd64a2 (diff) | |
[2.2.x] Changed poll_id to poll_ids in examples of custom management commands.
Backport of fa422dd78b9a90143913ebb1d8c0e796504c2bee from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/howto/custom-management-commands.txt | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/howto/custom-management-commands.txt b/docs/howto/custom-management-commands.txt index d547bd97e2..0e9608bc9c 100644 --- a/docs/howto/custom-management-commands.txt +++ b/docs/howto/custom-management-commands.txt @@ -49,10 +49,10 @@ look like this:: help = 'Closes the specified poll for voting' def add_arguments(self, parser): - parser.add_argument('poll_id', nargs='+', type=int) + parser.add_argument('poll_ids', nargs='+', type=int) def handle(self, *args, **options): - for poll_id in options['poll_id']: + for poll_id in options['poll_ids']: try: poll = Poll.objects.get(pk=poll_id) except Poll.DoesNotExist: @@ -77,7 +77,7 @@ look like this:: self.stdout.write("Unterminated line", ending='') The new custom command can be called using ``python manage.py closepoll -<poll_id>``. +<poll_ids>``. The ``handle()`` method takes one or more ``poll_ids`` and sets ``poll.opened`` to ``False`` for each one. If the user referenced any nonexistent polls, a @@ -97,7 +97,7 @@ options can be added in the :meth:`~BaseCommand.add_arguments` method like this: class Command(BaseCommand): def add_arguments(self, parser): # Positional arguments - parser.add_argument('poll_id', nargs='+', type=int) + parser.add_argument('poll_ids', nargs='+', type=int) # Named (optional) arguments parser.add_argument( |
