Code

Ticket #19115: 19115.3.patch

File 19115.3.patch, 1.0 KB (added by d1ffuz0r, 18 months ago)
  • docs/ref/django-admin.txt

    diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt
    index e0b0845..9417197 100644
    a b a natural key definition. If you are dumping ``contrib.auth`` ``Permission`` 
    212212objects or ``contrib.contenttypes`` ``ContentType`` objects, you should 
    213213probably be using this flag. 
    214214 
     215Also, ``dumpdata`` command support saving output to named file. See 
     216:func:`django.core.management.call_command`. 
     217 
    215218flush 
    216219----- 
    217220 
    To call a management command from code use ``call_command``. 
    14581461``name`` 
    14591462  the name of the command to call. 
    14601463 
     1464``stdout`` 
     1465    output redirection to file-like object. 
     1466 
    14611467``*args`` 
    14621468  a list of arguments accepted by the command. 
    14631469 
    Examples:: 
    14691475      from django.core import management 
    14701476      management.call_command('flush', verbosity=0, interactive=False) 
    14711477      management.call_command('loaddata', 'test_data', verbosity=0) 
     1478 
     1479      with open('/tmp/command_output') as f: 
     1480          management.call_command('dumpdata', stdout=f)