mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Merged regressiontests and modeltests into the test root.
This commit is contained in:
0
tests/user_commands/management/commands/__init__.py
Normal file
0
tests/user_commands/management/commands/__init__.py
Normal file
20
tests/user_commands/management/commands/dance.py
Normal file
20
tests/user_commands/management/commands/dance.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from optparse import make_option
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Dance around like a madman."
|
||||
args = ''
|
||||
requires_model_validation = True
|
||||
|
||||
option_list = BaseCommand.option_list + (
|
||||
make_option("-s", "--style", default="Rock'n'Roll"),
|
||||
make_option("-x", "--example")
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
example = options["example"]
|
||||
if example == "raise":
|
||||
raise CommandError()
|
||||
self.stdout.write("I don't feel like dancing %s." % options["style"])
|
||||
@@ -0,0 +1,10 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import translation
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
can_import_settings = True
|
||||
leave_locale_alone = False
|
||||
|
||||
def handle(self, *args, **options):
|
||||
return translation.get_language()
|
||||
@@ -0,0 +1,10 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import translation
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
can_import_settings = True
|
||||
leave_locale_alone = True
|
||||
|
||||
def handle(self, *args, **options):
|
||||
return translation.get_language()
|
||||
Reference in New Issue
Block a user