def handle(self, *args, **options):
        username = options['username']

        try:
            statictoken = add_static_token(username, options.get('token'))
        except get_user_model().DoesNotExist:
            raise CommandError('User "{0}" does not exist.'.format(username))

        self.stdout.write(force_text(statictoken.token))
示例#2
0
    def handle(self, *args, **options):
        if len(args) != 1:
            raise CommandError('Please specify exactly one username.')

        username = args[0]

        try:
            statictoken = add_static_token(username, options.get('token'))
        except get_user_model().DoesNotExist:
            raise CommandError('User "{0}" does not exist.'.format(username))

        self.stdout.write(statictoken.token)
示例#3
0
    def handle(self, *args, **options):
        if len(args) != 1:
            raise CommandError('Please specify exactly one username.')

        username = args[0]

        try:
            statictoken = add_static_token(username, options.get('token'))
        except get_user_model().DoesNotExist:
            raise CommandError('User "{0}" does not exist.'.format(username))

        print(statictoken.token, file=self.stdout)