[1.11.x] Fixed #28367 -- Doc'd how to override management commands.
Backport of 48d92fea67
from master
This commit is contained in:
parent
e921e98387
commit
f9db06cf08
|
@ -186,6 +186,24 @@ Testing
|
|||
Information on how to test custom management commands can be found in the
|
||||
:ref:`testing docs <topics-testing-management-commands>`.
|
||||
|
||||
Overriding commands
|
||||
===================
|
||||
|
||||
Django registers the built-in commands and then searches for commands in
|
||||
:setting:`INSTALLED_APPS` in reverse. During the search, if a command name
|
||||
duplicates an already registered command, the newly discovered command
|
||||
overrides the first.
|
||||
|
||||
In other words, to override a command, the new command must have the same name
|
||||
and its app must be before the overridden command's app in
|
||||
:setting:`INSTALLED_APPS`.
|
||||
|
||||
Management commands from third-party apps that have been unintentionally
|
||||
overridden can be made available under a new name by creating a new command in
|
||||
one of your project's apps (ordered before the third-party app in
|
||||
:setting:`INSTALLED_APPS`) which imports the ``Command`` of the overridden
|
||||
command.
|
||||
|
||||
Command objects
|
||||
===============
|
||||
|
||||
|
|
Loading…
Reference in New Issue