def handle(self, *args, **options):
        command = options.get('command', args[0] if len(args) > 0 else None)
        verbosity = int(options.get('verbosity'))

        if command is not None:
            if command.lower() in ('on', 'activate'):
                maintenance.activate()
                if verbosity > 0:
                    self.stdout.write(
                        "Maintenance mode was activated succesfully")
            elif command.lower() in ('off', 'deactivate'):
                maintenance.deactivate()
                if verbosity > 0:
                    self.stdout.write(
                        "Maintenance mode was deactivated succesfully")

        if command not in self.opts:
            raise CommandError(
                "Allowed commands are: %s" % '|'.join(self.opts))
Пример #2
0
    def handle(self, *args, **options):
        command = options.get("command", args[0] if len(args) > 0 else None)
        verbosity = int(options.get("verbosity"))

        if command is not None:
            if command.lower() in ("on", "activate"):
                maintenance.activate()
                if verbosity > 0:
                    self.stdout.write(
                        "Maintenance mode was activated succesfully")
            elif command.lower() in ("off", "deactivate"):
                maintenance.deactivate()
                if verbosity > 0:
                    self.stdout.write(
                        "Maintenance mode was deactivated succesfully")

        if command not in self.opts:
            raise CommandError("Allowed commands are: %s" %
                               "|".join(self.opts))
    def handle(self, *args, **options):
        command = options.get('command', args[0] if len(args) > 0 else None)
        verbosity = int(options.get('verbosity'))

        if command is not None:
            if command.lower() in ('on', 'activate'):
                maintenance.activate()
                if verbosity > 0:
                    self.stdout.write(
                        "Maintenance mode was activated succesfully")
            elif command.lower() in ('off', 'deactivate'):
                maintenance.deactivate()
                if verbosity > 0:
                    self.stdout.write(
                        "Maintenance mode was deactivated succesfully")

        if command not in self.opts:
            raise CommandError("Allowed commands are: %s" %
                               '|'.join(self.opts))
Пример #4
0
    def setUp(self):
        utils.deactivate()  # make sure maintenance mode is off

        self.user = User.objects.create_user(
            username='******', email='*****@*****.**', password='******')
Пример #5
0
    def setUp(self):
        utils.deactivate()  # make sure maintenance mode is off

        self.user = User.objects.create_user(
            username="******", email="*****@*****.**", password="******"
        )
    def setUp(self):
        utils.deactivate()  # make sure maintenance mode is off

        self.user = User.objects.create_user(
            username="******", email="*****@*****.**", password="******"
        )