2009-04-06 01:27:26 +08:00
|
|
|
from optparse import make_option
|
2011-10-14 02:04:12 +08:00
|
|
|
|
2012-05-27 02:50:44 +08:00
|
|
|
from django.core.management.base import BaseCommand, CommandError
|
2007-09-22 00:19:20 +08:00
|
|
|
|
2011-10-14 02:04:12 +08:00
|
|
|
|
2007-09-22 00:19:20 +08:00
|
|
|
class Command(BaseCommand):
|
|
|
|
help = "Dance around like a madman."
|
|
|
|
args = ''
|
|
|
|
requires_model_validation = True
|
|
|
|
|
2012-05-27 02:50:44 +08:00
|
|
|
option_list = BaseCommand.option_list + (
|
2012-02-10 02:56:41 +08:00
|
|
|
make_option("-s", "--style", default="Rock'n'Roll"),
|
|
|
|
make_option("-x", "--example")
|
2012-05-27 02:50:44 +08:00
|
|
|
)
|
2009-04-06 01:27:26 +08:00
|
|
|
|
2007-09-22 00:19:20 +08:00
|
|
|
def handle(self, *args, **options):
|
2012-02-10 02:56:41 +08:00
|
|
|
example = options["example"]
|
2012-05-27 02:50:44 +08:00
|
|
|
if example == "raise":
|
|
|
|
raise CommandError()
|
2010-09-13 13:28:01 +08:00
|
|
|
self.stdout.write("I don't feel like dancing %s." % options["style"])
|