mirror of
				https://github.com/django/django.git
				synced 2025-11-04 05:35:37 +00:00 
			
		
		
		
	Fixed #26294 -- Clarified call_command()'s handling of args and options.
This commit is contained in:
		
							parent
							
								
									402da9ab7b
								
							
						
					
					
						commit
						5695c142d2
					
				
					 1 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
					@ -1764,10 +1764,15 @@ To call a management command from code use ``call_command``.
 | 
				
			||||||
  preferred unless the object is required for testing.
 | 
					  preferred unless the object is required for testing.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
``*args``
 | 
					``*args``
 | 
				
			||||||
  a list of arguments accepted by the command.
 | 
					  a list of arguments accepted by the command. Arguments are passed to the
 | 
				
			||||||
 | 
					  argument parser, so you can use the same style as you would on the command
 | 
				
			||||||
 | 
					  line. For example, ``call_command('flush', 'verbosity=0')``.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
``**options``
 | 
					``**options``
 | 
				
			||||||
  named options accepted on the command-line.
 | 
					  named options accepted on the command-line. Options are passed to the command
 | 
				
			||||||
 | 
					  without triggering the argument parser, which means you'll need to pass the
 | 
				
			||||||
 | 
					  correct type. For example, ``call_command('flush', verbosity=0)`` (zero must
 | 
				
			||||||
 | 
					  be an integer rather than a string).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Examples::
 | 
					Examples::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue