summaryrefslogtreecommitdiff
path: root/tests/modeltests/user_commands
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2007-09-25 00:08:38 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2007-09-25 00:08:38 +0000
commit609eaf130d2d9eac109aefa59bfced32b67b9eb1 (patch)
treeb8bf4fd18c0fe75a418525baefa485c5ce31ce2f /tests/modeltests/user_commands
parentafb8f0a61969dff6450cd296be5eac2a5693ecd9 (diff)
newforms-admin: Merged to [6416]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@6417 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/user_commands')
-rw-r--r--tests/modeltests/user_commands/__init__.py0
-rw-r--r--tests/modeltests/user_commands/management/__init__.py0
-rw-r--r--tests/modeltests/user_commands/management/commands/__init__.py0
-rw-r--r--tests/modeltests/user_commands/management/commands/dance.py9
-rw-r--r--tests/modeltests/user_commands/models.py30
5 files changed, 39 insertions, 0 deletions
diff --git a/tests/modeltests/user_commands/__init__.py b/tests/modeltests/user_commands/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/modeltests/user_commands/__init__.py
diff --git a/tests/modeltests/user_commands/management/__init__.py b/tests/modeltests/user_commands/management/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/modeltests/user_commands/management/__init__.py
diff --git a/tests/modeltests/user_commands/management/commands/__init__.py b/tests/modeltests/user_commands/management/commands/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/modeltests/user_commands/management/commands/__init__.py
diff --git a/tests/modeltests/user_commands/management/commands/dance.py b/tests/modeltests/user_commands/management/commands/dance.py
new file mode 100644
index 0000000000..5886cd1d8f
--- /dev/null
+++ b/tests/modeltests/user_commands/management/commands/dance.py
@@ -0,0 +1,9 @@
+from django.core.management.base import BaseCommand
+
+class Command(BaseCommand):
+ help = "Dance around like a madman."
+ args = ''
+ requires_model_validation = True
+
+ def handle(self, *args, **options):
+ print "I don't feel like dancing." \ No newline at end of file
diff --git a/tests/modeltests/user_commands/models.py b/tests/modeltests/user_commands/models.py
new file mode 100644
index 0000000000..5f96806dac
--- /dev/null
+++ b/tests/modeltests/user_commands/models.py
@@ -0,0 +1,30 @@
+"""
+37. User-registered management commands
+
+The manage.py utility provides a number of useful commands for managing a
+Django project. If you want to add a utility command of your own, you can.
+
+The user-defined command 'dance' is defined in the management/commands
+subdirectory of this test application. It is a simple command that responds
+with a printed message when invoked.
+
+For more details on how to define your own manage.py commands, look at the
+django.core.management.commands directory. This directory contains the
+definitions for the base Django manage.py commands.
+"""
+
+__test__ = {'API_TESTS': """
+>>> from django.core import management
+
+# Invoke a simple user-defined command
+>>> management.call_command('dance')
+I don't feel like dancing.
+
+# Invoke a command that doesn't exist
+>>> management.call_command('explode')
+Traceback (most recent call last):
+...
+CommandError: Unknown command: 'explode'
+
+
+"""} \ No newline at end of file