Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#25827 closed Bug (fixed)

DateTimeField in admin TabularInline has unsightly left margin

Reported by: Tim Graham Owned by: nobody
Component: contrib.admin Version: 1.8
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

See attached screenshot. Besides the left margin issue, I think ideally the date and time would be side by side so the row isn't expanded vertically just for that field but that's not a strict requirement if it turns out to be complicated or undesirable in your opinion. This affects TabularInline; please be sure not to break StackedInline with your fix.

Attachments (1)

25827.png (84.4 KB ) - added by Tim Graham 9 years ago.

Download all attachments as: .zip

Change History (6)

by Tim Graham, 9 years ago

Attachment: 25827.png added

comment:1 by Baptiste Mispelon, 9 years ago

From what I can tell, the margin-left: 160px for datetime fields was added in the big flat theme update: 35901e64b043733acd1687734274553cf994511b.

Removing it from the CSS [1] doesn't impact the StackedInline because they use a different CSS rule [2].

I also agree that it would be better to let the browser decide whether to place the date and time inputs side-by-side or on top of each other depending on how much space there is.

[1] https://github.com/django/django/blob/master/django/contrib/admin/static/admin/css/widgets.css#L259
[2] https://github.com/django/django/blob/master/django/contrib/admin/static/admin/css/forms.css#L90

comment:2 by Baptiste Mispelon, 9 years ago

(I spoke a bit too fast about the change not affecting StackedInline: a 10px appears when you delete the rule).

This small change seems to fix it for me with no ill effect that I can see:

  • django/contrib/admin/static/admin/css/forms.css

    diff --git a/django/contrib/admin/static/admin/css/forms.css b/django/contrib/admin/static/admin/css/forms.css
    index 2a21257..f43cc7b 100644
    a b form ul.inline li {  
    8787    padding: 6px 0;
    8888    margin-top: 0;
    8989    margin-bottom: 0;
    90     margin-left: 170px;
     90    margin-left: 160px;
    9191}
    9292
    9393.aligned ul label {
  • django/contrib/admin/static/admin/css/widgets.css

    diff --git a/django/contrib/admin/static/admin/css/widgets.css b/django/contrib/admin/static/admin/css/widgets.css
    index 15d3f83..8150e0f 100644
    a b p.datetime {  
    256256}
    257257
    258258form .form-row p.datetime {
    259     margin-left: 160px;
    260259    padding-left: 10px;
    261260}
    262261

comment:3 by Tim Graham, 9 years ago

Easy pickings: unset
Has patch: set
Severity: NormalRelease blocker

Thanks, I filed an issue on django-flat-theme and will make sure this gets addressed for the 1.9 release on Tuesday.

comment:4 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 2084aed:

Fixed #25827 -- Removed extra spacing in admin's DateTimeField.

comment:5 by Tim Graham <timograham@…>, 9 years ago

In d9df079:

[1.9.x] Fixed #25827 -- Removed extra spacing in admin's DateTimeField.

Backport of 2084aed20c4d350a4192a0cfaa22140d4af3396c from master

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