Changes between Initial Version and Version 1 of Ticket #36926, comment 6


Ignore:
Timestamp:
Feb 23, 2026, 12:22:41 PM (11 days ago)
Author:
Natalia Bidart

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36926, comment 6

    initial v1  
    11Yes, that is exactly right. When a field is a direct BooleanField on the model for example
    2 {{{
     2{{{#!python
    33list_display = ['is_active']
    44}}}
     
    77This is handled in display_for_field() in django/contrib/admin/utils.py:
    88
    9 {{{
     9{{{#!python
    1010elif isinstance(field, models.BooleanField):
    1111     return _boolean_icon(value)
     
    1313
    1414
    15 The bug is specifically about **related field traversal**. When you write  'profile__verified' instead of 'verified', Django cannot find the field  via _get_non_gfk_field() because the name contains '__', so it falls back to f=None. With f=None, it calls display_for_value() instead of  display_for_field(), which simply returns str(value) → "True"/"False".
     15The bug is specifically about **related field traversal**. When you write  `profile__verified` instead of `verified`, Django cannot find the field  via `_get_non_gfk_field()` because the name contains `__`, so it falls back to `f=None`. With `f=None`, it calls `display_for_value()` instead of `display_for_field()`, which simply returns `str(value)` → "True"/"False".
    1616
    17 This fix closes that gap: when traversing a relation path with '__', we resolve the final field using get_fields_from_path() and pass it as f, so display_for_field() is called correctly and the same automatic boolean icon behavior that exists for direct fields is preserved.
     17This fix closes that gap: when traversing a relation path with `__`, we resolve the final field using `get_fields_from_path()` and pass it as `f`, so `display_for_field()` is called correctly and the same automatic boolean icon behavior that exists for direct fields is preserved.
    1818
    19 Regarding your question about plain text being useful, No, there is no case where a BooleanField should display as plain text in the changelist. Django already makes this decision unconditionally for direct BooleanFields, the fix simply extends that same existing behavior to related field traversal for consistency.
     19Regarding your question about plain text being useful, No, there is no case where a `BooleanField` should display as plain text in the changelist. Django already makes this decision unconditionally for direct `BooleanField`s, the fix simply extends that same existing behavior to related field traversal for consistency.
Back to Top