mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Refs #33476 -- Made management commands use black.
Run black on generated files, if it is available on PATH.
This commit is contained in:
parent
f9ec777a82
commit
d113b5a837
10 changed files with 96 additions and 16 deletions
|
@ -2050,6 +2050,24 @@ distribution. It enables tab-completion of ``django-admin`` and
|
|||
|
||||
See :doc:`/howto/custom-management-commands` for how to add customized actions.
|
||||
|
||||
Black formatting
|
||||
----------------
|
||||
|
||||
.. versionadded:: 4.1
|
||||
|
||||
The Python files created by :djadmin:`startproject`, :djadmin:`startapp`,
|
||||
:djadmin:`makemigrations`, and :djadmin:`squashmigrations` are formatted using
|
||||
the ``black`` command if it is present on your ``PATH``.
|
||||
|
||||
If you have ``black`` globally installed, but do not wish it used for the
|
||||
current project, you can set the ``PATH`` explicitly::
|
||||
|
||||
PATH=path/to/venv/bin django-admin makemigrations
|
||||
|
||||
For commands using ``stdout`` you can pipe the output to ``black`` if needed::
|
||||
|
||||
django-admin inspectdb | black -
|
||||
|
||||
==========================================
|
||||
Running management commands from your code
|
||||
==========================================
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue