#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)
Change History (6)
by , 9 years ago
comment:1 by , 9 years ago
comment:2 by , 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 { 87 87 padding: 6px 0; 88 88 margin-top: 0; 89 89 margin-bottom: 0; 90 margin-left: 1 70px;90 margin-left: 160px; 91 91 } 92 92 93 93 .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 { 256 256 } 257 257 258 258 form .form-row p.datetime { 259 margin-left: 160px;260 259 padding-left: 10px; 261 260 } 262 261
comment:3 by , 9 years ago
Easy pickings: | unset |
---|---|
Has patch: | set |
Severity: | Normal → Release blocker |
Thanks, I filed an issue on django-flat-theme and will make sure this gets addressed for the 1.9 release on Tuesday.
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