[Django] #29248: Model field names can conflict with field-box CSS class in Admin

9 views
Skip to first unread message

Django

unread,
Mar 22, 2018, 9:32:56 AM3/22/18
to django-...@googlegroups.com
#29248: Model field names can conflict with field-box CSS class in Admin
-----------------------------------------+------------------------
Reporter: Phil Gyford | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-----------------------------------------+------------------------
In Admin edit screens, fields are given a CSS class with their field name.
e.g. A model field called `title` will have its input field, label, etc,
surrounded by a div like: `<div class="form-row field-title">`.

However there is a `field-box` class used in admin's `forms.css`
stylesheet:

{{{
fieldset .field-box {
float: left;
margin-right: 20px;
}
}}}

So, if you have a model with a field called `box`, then when it's
displayed on an Admin edit screen it is floated left and the next field
appears to its right:

[[Image(https://i.imgur.com/wYuausq.png)]]

I ''think'' that `field-box` is the only such potential conflict in
`forms.css`. I guess it should be renamed to something that does not start
with `field-`?

--
Ticket URL: <https://code.djangoproject.com/ticket/29248>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 22, 2018, 9:40:50 AM3/22/18
to django-...@googlegroups.com
#29248: Model field names can conflict with admin's field-box CSS class
-------------------------------+------------------------------------

Reporter: Phil Gyford | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham):

* cc: elky (added)
* stage: Unreviewed => Accepted


Comment:

A note in the "backwards incompatible changes" section of the release
notes may be useful as that class has been there since Django 1.0
(7a9b55ddc4d49775a696d1d34629ebbad2499fa3).

--
Ticket URL: <https://code.djangoproject.com/ticket/29248#comment:1>

Django

unread,
Mar 22, 2018, 3:13:00 PM3/22/18
to django-...@googlegroups.com
#29248: Model field names can conflict with admin's field-box CSS class
-------------------------------+------------------------------------
Reporter: Phil Gyford | Owner: faheel
Type: Bug | Status: assigned
Component: contrib.admin | Version: 2.0

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by faheel):

* owner: nobody => faheel
* status: new => assigned


Comment:

It does seem like `field-box` is the only potentially conflicting class in
`forms.css` as no other class starts with `field-`. My suggestion is to
rename it to either `fieldbox` or `field__box` (this one is based on the
[https://en.bem.info/methodology/quick-start/ BEM methodology]).

--
Ticket URL: <https://code.djangoproject.com/ticket/29248#comment:2>

Django

unread,
Mar 26, 2018, 2:10:27 PM3/26/18
to django-...@googlegroups.com
#29248: Model field names can conflict with admin's field-box CSS class
-------------------------------+----------------------------------------
Reporter: Phil Gyford | Owner: Faheel Ahmad
Type: Bug | Status: assigned
Component: contrib.admin | Version: 2.0

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+----------------------------------------

Comment (by Faheel Ahmad):

Since classes in `forms.css` are in camel case, `fieldBox` seems to be the
appropriate choice to me. If anyone has any suggestion regarding this do
let me know. I'll have a PR ready in a few days.

--
Ticket URL: <https://code.djangoproject.com/ticket/29248#comment:3>

Django

unread,
Apr 5, 2018, 5:54:31 AM4/5/18
to django-...@googlegroups.com
#29248: Model field names can conflict with admin's field-box CSS class
-------------------------------+----------------------------------------
Reporter: Phil Gyford | Owner: Faheel Ahmad
Type: Bug | Status: assigned
Component: contrib.admin | Version: 2.0

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+----------------------------------------
Changes (by Faheel Ahmad):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/9855 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/29248#comment:4>

Django

unread,
Apr 5, 2018, 9:36:13 AM4/5/18
to django-...@googlegroups.com
#29248: Model field names can conflict with admin's field-box CSS class
-------------------------------------+-------------------------------------

Reporter: Phil Gyford | Owner: Faheel
| Ahmad
Type: Bug | Status: assigned
Component: contrib.admin | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/29248#comment:5>

Django

unread,
Apr 5, 2018, 10:56:04 AM4/5/18
to django-...@googlegroups.com
#29248: Model field names can conflict with admin's field-box CSS class
-------------------------------------+-------------------------------------
Reporter: Phil Gyford | Owner: Faheel
| Ahmad
Type: Bug | Status: closed
Component: contrib.admin | Version: 2.0
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"5d4d62bf4fe887fcd30f9f0449de07ae76ea5968" 5d4d62b]:
{{{
#!CommitTicketReference repository=""
revision="5d4d62bf4fe887fcd30f9f0449de07ae76ea5968"
Fixed #29248 -- Renamed admin CSS class field-box to fieldBox.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29248#comment:6>

Reply all
Reply to author
Forward
0 new messages