{{{
@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.
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>
* cc: elky (added)
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/29045#comment:2>
* owner: nobody => Anoosha keen
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/29045#comment:3>
* owner: Anoosha keen => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/29045#comment:4>
* owner: nobody => Jonah Bishop
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/29045#comment:3>
* 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>
* 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>