Opened 46 minutes ago

Last modified 2 minutes ago

#37332 assigned Bug

Admin `list_display` does not show icon for generated boolean fields

Reported by: Marijke Luttekes Owned by: Yassin Bahri
Component: contrib.admin Version: 6.1
Severity: Normal Keywords: admin
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description

Per the Django 6.1 release notes:

list_display now uses boolean icons for boolean fields on related models.

This does not work for instances of GeneratedField with output_field=models.BooleanField(), like so:

from django.db import models

is_done = models.GeneratedField(
    # Redacted for brevity
    output_field=models.BooleanField(),
    db_persist=True,
)

Both fields in admin list display and filter (list_display and list_filter, respectively) show the output of these fields as True or False.

NB. The code I used for this is currently on a feature branch that's actively being pushed over: https://github.com/MHLut/django-local-test/tree/feature/todo.

Attachments (1)

Screenshot 2026-09-08 at 16.39.05.png (12.4 KB ) - added by Marijke Luttekes 46 minutes ago.

Download all attachments as: .zip

Change History (3)

by Marijke Luttekes, 46 minutes ago

comment:1 by Yassin Bahri, 2 minutes ago

Triage Stage: UnreviewedAccepted

I can reproduce this on Django 6.1.

Create a model with a generated boolean field:

class Item(models.Model):
    value = models.BooleanField(default=False)
    is_done = models.GeneratedField(
        expression=models.F("value"),
        output_field=models.BooleanField(),
        db_persist=True,
    )

Add the field to an admin changelist:

@admin.register(Item)
class ItemAdmin(admin.ModelAdmin):
    list_display = ("is_done",)

After creating one object with value=True and another with value=False, the changelist displays the literal text True and False.

Regular BooleanField values are rendered with Django’s boolean icons (icon-yes.svg and icon-no.svg), so generated boolean fields should behave consistently.

comment:2 by Yassin Bahri, 2 minutes ago

Has patch: set
Owner: set to Yassin Bahri
Status: newassigned
Note: See TracTickets for help on using tickets.
Back to Top