Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix 21075 #1609

Closed
wants to merge 2 commits into from

2 participants

@oz123

fix for ticket #21075

Extracted the most important information learned from the
ticket and added it to the correct section in the documentation.
Hopefully, it will spare other people the time and improve
how management.call_command is used.

oz123 added some commits
@oz123 oz123 fix for ticket #21075
Extracted the most important information learned from the
ticket and added it to the correct section in the documentation.
Hopefully, it will spare other people the time and improve
how `management.call_command` is used.
56b1803
@oz123 oz123 add erased example for a more comperhansive set e3f5b9a
@timgraham
Owner

merged in fca4c48 - thanks!

@timgraham timgraham closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 10, 2013
  1. @oz123

    fix for ticket #21075

    oz123 authored
    Extracted the most important information learned from the
    ticket and added it to the correct section in the documentation.
    Hopefully, it will spare other people the time and improve
    how `management.call_command` is used.
  2. @oz123
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 1 deletion.
  1. +13 −1 docs/ref/django-admin.txt
View
14 docs/ref/django-admin.txt
@@ -1628,6 +1628,7 @@ To call a management command from code use ``call_command``.
``*args``
a list of arguments accepted by the command.
+
``**options``
named options accepted on the command-line.
@@ -1636,7 +1637,18 @@ Examples::
from django.core import management
management.call_command('flush', verbosity=0, interactive=False)
- management.call_command('loaddata', 'test_data', verbosity=0)
+ management.call_command('loaddata', 'test_data', verbosity=0)
+
+Note that command line options for a subcommand that take no arguments, like the above
+example are called as a keyword with ``True`` or ``False``, another example would be::
+
+ management.call_command('dumpdata', use_natural_keys=True)
+
+Other command line options which take multiple options will be called with a list. For
+example the above mentiond ``--exclude`` option for the subcommand ``dumpdata`` would be::
+
+ management.call_command('dumpdata', exclude=['contenttypes', 'auth'])
+
Output redirection
==================
Something went wrong with that request. Please try again.