File: my_command.py

package info (click to toggle)
python-pytest-djangoapp 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 396 kB
  • sloc: python: 1,116; makefile: 114; sh: 6
file content (26 lines) | stat: -rw-r--r-- 616 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from django.core.management.base import BaseCommand

from .compat import options_getter, CommandOption

get_options = options_getter((
    CommandOption('--two', action='store'),
))


class Command(BaseCommand):

    help = 'Sends scheduled messages (both in pending and error statuses).'

    option_list = get_options()

    def add_arguments(self, parser):
        parser.add_argument('one')
        get_options(parser.add_argument)

    def handle(self, one, **options):
        self.stdout.write('bingo')
        self.stderr.write('bongo')

        two = options.get('two', None)

        return f'{one}|{two}'