Opened 2 months ago

Closed 11 days ago

Last modified 11 days ago

#36788 closed Bug (fixed)

Admin fieldsets no longer arranged horizontally

Reported by: Ronald Ligteringen Owned by: Jacob Walls
Component: contrib.admin Version: 6.0
Severity: Release blocker Keywords: horizontal alignment admin fieldset
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description

To horizontally align fields in the admin change page you can combine these fields in a tuple, like this:

fields = ["name", ("age", "gender"), "nationality"]

In this example, the change screen would show something like this:

name:
age: gender:
nationality:

This works great in version 5, however this is not working in 6.0. This will show all fields vertically like this:

name:
age:
gender:
nationality:

Attachments (2)

image-20260120-113611.png (31.9 KB ) - added by Martin 3 weeks ago.
image-20260120-113747.png (32.8 KB ) - added by Martin 3 weeks ago.

Download all attachments as: .zip

Change History (11)

comment:1 by Jacob Walls, 2 months ago

Resolution: worksforme
Status: newclosed

Works fine for me with 6.0. Do you have a reproducer?

by Martin, 3 weeks ago

Attachment: image-20260120-113611.png added

by Martin, 3 weeks ago

Attachment: image-20260120-113747.png added

comment:2 by Martin, 3 weeks ago

Resolution: worksforme
Status: closednew

I'm seeing this same issue with fields rendered in a fieldset.
I figure it's caused by the fix for issue #36807.

from django.db import models
from django.contrib import admin

class FormMultilineTest(models.Model):
    date = models.DateTimeField()
    boolean = models.BooleanField(default=False)
    boolean2 = models.BooleanField(default=False)
    text = models.CharField(max_length=100)

class FormMultilineTestAdmin(admin.ModelAdmin):
    fieldsets = (
        (None, {
            'fields': (
                ('text', 'date',),
                ('boolean', 'boolean2'),
            )
        }
         ),
    )
admin.site.register(FormMultilineTest, FormMultilineTestAdmin)

Results in the first two fields being one below another, while the booleans are as expected:

The expected result (on 5.2.10):

comment:3 by Jacob Walls, 3 weeks ago

Keywords: fieldset added; fields removed
Owner: set to Jacob Walls
Severity: NormalRelease blocker
Status: newassigned
Summary: horizontal alignment of fields in admin change not working in 6.0Admin fieldsets no longer arranged horizontally
Triage Stage: UnreviewedAccepted

Thanks, with that I can reproduce.

Regression in 4187da258fe212d494cb578a0bc2b52c4979ab95.

comment:4 by Jacob Walls, 3 weeks ago

Has patch: set

comment:5 by Antoliny, 11 days ago

Triage Stage: AcceptedReady for checkin

comment:6 by Jacob Walls <jacobtylerwalls@…>, 11 days ago

Resolution: fixed
Status: assignedclosed

In b665a67:

Fixed #36788 -- Fixed horizontal form field alignment under <fieldset> in the admin.

Thanks Antoliny for the review.

Regression in 4187da258fe212d494cb578a0bc2b52c4979ab95.

comment:7 by Jacob Walls <jacobtylerwalls@…>, 11 days ago

In d725f685:

Refs #36788 -- Added missing CSS selector for fieldsets in the admin.

comment:8 by Jacob Walls <jacobtylerwalls@…>, 11 days ago

In f9bfb527:

[6.0.x] Fixed #36788 -- Fixed horizontal form field alignment under <fieldset> in the admin.

Thanks Antoliny for the review.

Regression in 4187da258fe212d494cb578a0bc2b52c4979ab95.

Backport of b665a67d61a8a4fd2ad85aeb77282bc49541723f from main.

comment:9 by Jacob Walls <jacobtylerwalls@…>, 11 days ago

In d64ef24:

[6.0.x] Refs #36788 -- Added missing CSS selector for fieldsets in the admin.

Backport of d725f6856d7488ba2a397dfe47dd851420188159 from main.

Note: See TracTickets for help on using tickets.
Back to Top