[Django] #29560: Add an option to django-admin to always colorize output

11 views
Skip to first unread message

Django

unread,
Jul 11, 2018, 6:10:23 AM7/11/18
to django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas | Owner: nobody
Noé |
Type: | Status: new
Uncategorized |
Component: Core | Version: master
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
With Django management commands, it is currently possible disable colors
with the `--no-colors` flag.

What I'd like to have is basically the other side of the coin: a `--force-
colors` flag that instructs Django to output ANSI color sequences in cases
it would disable colors by default (typically, when the output is piped to
another command, as documented).

My real world use-case is the following one: I have a custom Django
command to import data. I run this command myself, and I'd like to send a
colored log (HTML seems perfect for this) to the data curators. I can use
the https://github.com/theZiz/aha utility for this, but that doesn't work
since Django disable colors when the output is piped.

Other *nix commands have a special flag for this exact use-case, for
example `$ ls --color=always`

--
Ticket URL: <https://code.djangoproject.com/ticket/29560>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 12, 2018, 4:38:54 AM7/12/18
to django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: nobody
Type: New feature | Status: new
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* cc: Carlton Gibson (added)
* type: Uncategorized => New feature
* stage: Unreviewed => Accepted


Comment:

Hi Nicolas. I'm going to Accept this: it seems reasonable.

> …in cases it would disable colors by default (typically, when the output


is piped to another command, as documented).

Can I ask, where is this documented? I cannot seem to find it. Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/29560#comment:1>

Django

unread,
Jul 12, 2018, 4:44:13 AM7/12/18
to django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: nobody
Type: New feature | Status: new
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Nicolas Noé):

Thanks Carlton!

It is documented in https://docs.djangoproject.com/en/2.0/ref/django-admin
/#syntax-coloring:

''The django-admin / manage.py commands will use pretty color-coded output
if your terminal supports ANSI-colored output. It won’t use the color
codes if you’re piping the command’s output to another program.''

--
Ticket URL: <https://code.djangoproject.com/ticket/29560#comment:2>

Django

unread,
Jul 12, 2018, 4:47:06 AM7/12/18
to django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: nobody
Type: New feature | Status: new
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

Thanks Nicolas. I just found that. (I must have been blind: I even looked
in that exact location... sigh :-)

--
Ticket URL: <https://code.djangoproject.com/ticket/29560#comment:3>

Django

unread,
Jul 12, 2018, 10:27:55 AM7/12/18
to django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: Nicolas
| Noé
Type: New feature | Status: assigned

Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Nicolas Noé):

* owner: nobody => Nicolas Noé
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/29560#comment:4>

Django

unread,
Jul 17, 2018, 4:08:45 AM7/17/18
to django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: (none)

Type: New feature | Status: new
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Nicolas Noé):

* status: assigned => new
* owner: Nicolas Noé => (none)


Comment:

I unfortunately can't find time in the short term to work on the
implementation...

--
Ticket URL: <https://code.djangoproject.com/ticket/29560#comment:5>

Django

unread,
Jul 22, 2018, 2:13:48 PM7/22/18
to django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: Hasan
| Ramezani

Type: New feature | Status: assigned
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* owner: (none) => Hasan Ramezani


* status: new => assigned

* has_patch: 0 => 1


Comment:

PR[https://github.com/django/django/pull/10213]

--
Ticket URL: <https://code.djangoproject.com/ticket/29560#comment:6>

Django

unread,
Jul 23, 2018, 10:10:08 AM7/23/18
to django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/29560#comment:7>

Django

unread,
Sep 7, 2018, 4:55:20 AM9/7/18
to django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


Comment:

This looks good to me. (I had a couple of tiny comment which I assume will
be addressed, so progressing.) Thanks Hasan.

Django

unread,
Sep 11, 2018, 11:47:07 AM9/11/18
to django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: Hasan
| Ramezani
Type: New feature | Status: closed

Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"5195b99e2c3804ec5f9c98d29e0cf76bf44b0cec" 5195b99e]:
{{{
#!CommitTicketReference repository=""
revision="5195b99e2c3804ec5f9c98d29e0cf76bf44b0cec"
Fixed #29560 -- Added --force-color management command option.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29560#comment:8>

Django

unread,
Sep 11, 2018, 12:47:53 PM9/11/18
to django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: Hasan
| Ramezani
Type: New feature | Status: closed
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"a4d8e412e0295ac7d40bb87ee6e5f44649f97816" a4d8e412]:
{{{
#!CommitTicketReference repository=""
revision="a4d8e412e0295ac7d40bb87ee6e5f44649f97816"
Refs #29560 -- Fixed typo in django/core/management/base.py.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29560#comment:9>

Reply all
Reply to author
Forward
0 new messages