Opened 6 weeks ago

Last modified 2 days ago

#36788 new Bug

horizontal alignment of fields in admin change not working in 6.0

Reported by: Ronald Ligteringen Owned by:
Component: contrib.admin Version: 6.0
Severity: Normal Keywords: horizontal alignment fields admin
Cc: Triage Stage: Unreviewed
Has patch: no 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 2 days ago.
image-20260120-113747.png (32.8 KB ) - added by Martin 2 days ago.

Download all attachments as: .zip

Change History (4)

comment:1 by Jacob Walls, 6 weeks ago

Resolution: worksforme
Status: newclosed

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

by Martin, 2 days ago

Attachment: image-20260120-113611.png added

by Martin, 2 days ago

Attachment: image-20260120-113747.png added

comment:2 by Martin, 2 days 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):

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