From fa422dd78b9a90143913ebb1d8c0e796504c2bee Mon Sep 17 00:00:00 2001 From: mentix02 Date: Fri, 10 May 2019 18:01:49 +0530 Subject: [PATCH] Changed poll_id to poll_ids in examples of custom management commands. --- docs/howto/custom-management-commands.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/howto/custom-management-commands.txt b/docs/howto/custom-management-commands.txt index aeee00016a..79ad61675d 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 -``. +``. 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(