Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

# -*- coding: UTF-8 -*- 

# Copyright 2013-2015 Luc Saffre 

# License: BSD (see file COPYING for details) 

 

""".. management_command:: show 

 

Show the content of a specified table to standard output. 

 

""" 

 

from optparse import make_option 

 

from django.core.management.base import BaseCommand, CommandError 

from django.conf import settings 

 

 

class Command(BaseCommand): 

    help = __doc__ 

    args = "action_spec [args ...]" 

 

    option_list = BaseCommand.option_list + ( 

        make_option( 

            '-u', '--username', action='store', dest='username', 

            default=None, 

            help='The username to act as. Default is `None`.'), 

        make_option( 

            '-l', '--language', action='store', dest='language', 

            help="The language to use. " 

            "Default is the site's default language."), 

    ) 

 

    def handle(self, *args, **options): 

        if len(args) == 0: 

            raise CommandError("I need at least one argument.") 

        #~ settings.SITE.startup() 

        spec = args[0] 

 

        username = options['username'] 

        ses = settings.SITE.login(username) 

 

        ses.show(spec, language=options['language'])