[Django] #29045: Multiple select widget does not honor size attribute

7 views
Skip to first unread message

Django

unread,
Jan 22, 2018, 12:27:47 PM1/22/18
to django-...@googlegroups.com
#29045: Multiple select widget does not honor size attribute
-----------------------------------------+------------------------
Reporter: Jonah Bishop | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
I have an admin page set up for a model like so:

{{{
@admin.register(p_models.ScheduleType)
class ScheduleTypeAdmin(admin.ModelAdmin):
formfield_overrides = {
models.ManyToManyField: {'widget':
forms.SelectMultiple(attrs={'size': '30'})},
}

list_display = ('name',)
}}}

The resulting ManyToMany field has the **size** attribute set properly,
but every browser I try only shows about 8 rows (not 30, as I instructed).
I've cleared cache, and tried in multiple browsers (Chrome 63, Firefox
57). My site uses Django 1.11.9.

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

Django

unread,
Jan 22, 2018, 1:08:45 PM1/22/18
to django-...@googlegroups.com
#29045: Multiple select widget does not honor size attribute
-------------------------------+--------------------------------------

Reporter: Jonah Bishop | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by Jonah Bishop:

Old description:

> I have an admin page set up for a model like so:
>
> {{{
> @admin.register(p_models.ScheduleType)
> class ScheduleTypeAdmin(admin.ModelAdmin):
> formfield_overrides = {
> models.ManyToManyField: {'widget':
> forms.SelectMultiple(attrs={'size': '30'})},
> }
>
> list_display = ('name',)
> }}}
>
> The resulting ManyToMany field has the **size** attribute set properly,
> but every browser I try only shows about 8 rows (not 30, as I
> instructed). I've cleared cache, and tried in multiple browsers (Chrome
> 63, Firefox 57). My site uses Django 1.11.9.

New description:

I have an admin page set up for a model like so:

{{{
@admin.register(p_models.ScheduleType)
class ScheduleTypeAdmin(admin.ModelAdmin):
formfield_overrides = {
models.ManyToManyField: {'widget':
forms.SelectMultiple(attrs={'size': '30'})},
}

list_display = ('name',)
}}}

The resulting ManyToMany field has the **size** attribute set properly,
but every browser I try only shows about 8 rows (not 30, as I instructed).
I've cleared cache, and tried in multiple browsers (Chrome 63, Firefox
57). My site uses Django 1.11.9.

It looks like the CSS style rules are overriding the **size** attribute.
I'm guessing adding a **height: auto;** rule to the **select[multiple]**
style set would fix it (it appears to do so in Chrome, at least).

--

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

Django

unread,
Jan 23, 2018, 12:59:12 PM1/23/18
to django-...@googlegroups.com
#29045: admin CSS overrides Select/SelectMultiple size attribute
-------------------------------+------------------------------------

Reporter: Jonah Bishop | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

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

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


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

Django

unread,
Jan 25, 2018, 2:00:22 AM1/25/18
to django-...@googlegroups.com
#29045: admin CSS overrides Select/SelectMultiple size attribute
-------------------------------+----------------------------------------
Reporter: Jonah Bishop | Owner: Anoosha keen
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.11

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

* owner: nobody => Anoosha keen
* status: new => assigned


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

Django

unread,
Jan 25, 2018, 2:50:05 AM1/25/18
to django-...@googlegroups.com
#29045: admin CSS overrides Select/SelectMultiple size attribute
-------------------------------+------------------------------------
Reporter: Jonah Bishop | Owner: (none)

Type: Bug | Status: new
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Anoosha keen):

* owner: Anoosha keen => (none)
* status: assigned => new


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

Django

unread,
Jul 10, 2018, 11:04:01 AM7/10/18
to django-...@googlegroups.com
#29045: admin CSS overrides Select/SelectMultiple size attribute
-------------------------------+----------------------------------------
Reporter: Jonah Bishop | Owner: Jonah Bishop
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.11

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

* owner: nobody => Jonah Bishop


* status: new => assigned


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

Django

unread,
Jul 10, 2018, 11:15:44 AM7/10/18
to django-...@googlegroups.com
#29045: admin CSS overrides Select/SelectMultiple size attribute
-------------------------------+----------------------------------------
Reporter: Jonah Bishop | Owner: Jonah Bishop
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.11

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

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+----------------------------------------
Changes (by Jonah Bishop):

* has_patch: 0 => 1


Comment:

I've added a pull request (https://github.com/django/django/pull/10169)
with a small patch to fix this issue. The fix was quite simple: a new
"height: auto;" rule for the select[multiple] style case.

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

Django

unread,
Jul 10, 2018, 4:38:26 PM7/10/18
to django-...@googlegroups.com
#29045: admin CSS overrides Select/SelectMultiple size attribute
-------------------------------+----------------------------------------
Reporter: Jonah Bishop | Owner: Jonah Bishop
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

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


Comment:

In [changeset:"263e03941187f4ffdd09b7e7ecee442717064083" 263e0394]:
{{{
#!CommitTicketReference repository=""
revision="263e03941187f4ffdd09b7e7ecee442717064083"
Fixed #29045 -- Fixed admin CSS so that select multiple elements honor the
HTML size attribute.
}}}

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

Reply all
Reply to author
Forward
0 new messages