[Django] #28157: Options order is lost in choicefields when mixing grouped and non-grouped options.

7 views
Skip to first unread message

Django

unread,
May 1, 2017, 1:51:06 PM5/1/17
to django-...@googlegroups.com
#28157: Options order is lost in choicefields when mixing grouped and non-grouped
options.
--------------------------------------+------------------------
Reporter: atopus | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 1 |
--------------------------------------+------------------------
With this tuple (fetched from django documentation),

{{{
MEDIA_CHOICES = (
('Audio', (
('vinyl', 'Vinyl'),
('cd', 'CD'),
)
),
('Video', (
('vhs', 'VHS Tape'),
('dvd', 'DVD'),
)
),
('unknown', 'Unknown'),
)
}}}

the "unknown" option is displayed at the beginning of the dropbox.

More generally, every non-grouped options are displayed first, followed by
grouped options.

If an embedded mix of them is needed -- which is my case -- the order is
entirely lost.

I guess this is not the expected behavior.

Thanks for your assistance,

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

Django

unread,
May 2, 2017, 9:19:18 AM5/2/17
to django-...@googlegroups.com
#28157: Options order is lost in choicefields when mixing grouped and non-grouped
options.
--------------------------------+--------------------------------------
Reporter: Paul Antropius | Owner: nobody

Type: Bug | Status: new
Component: Forms | 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: 1
--------------------------------+--------------------------------------
Changes (by Tim Graham):

* easy: 1 => 0


Comment:

I can't reproduce the behavior you describe using this model in the admin:
{{{
class Record(models.Model):
media = models.CharField(max_length=25, choices=MEDIA_CHOICES)
}}}
Can you add more details about how to reproduce the issue?

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

Django

unread,
May 2, 2017, 9:37:19 AM5/2/17
to django-...@googlegroups.com
#28157: Options order is lost in choicefields when mixing grouped and non-grouped
options.
---------------------------------+------------------------------------
Reporter: Paul Antropius | Owner: nobody

Type: Bug | Status: new
Component: Forms | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

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

* severity: Normal => Release blocker


* easy: 1 => 0

* stage: Unreviewed => Accepted


Comment:

Regression bisected to b52c73008a9d67e9ddbb841872dc15cdd3d6ee01 (template-
based widget rendering).

Django

unread,
May 2, 2017, 12:27:56 PM5/2/17
to django-...@googlegroups.com
#28157: Options order is lost in choicefields when mixing grouped and non-grouped
options.
---------------------------------+--------------------------------------
Reporter: Paul Antropius | Owner: Tim Graham
Type: Bug | Status: assigned
Component: Forms | Version: 1.11

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

* status: new => assigned
* owner: nobody => Tim Graham


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

Django

unread,
May 2, 2017, 1:21:12 PM5/2/17
to django-...@googlegroups.com
#28157: Options order is lost in choicefields when mixing grouped and non-grouped
options.
---------------------------------+--------------------------------------
Reporter: Paul Antropius | Owner: Tim Graham
Type: Bug | Status: assigned
Component: Forms | Version: 1.11

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

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

* has_patch: 0 => 1


Comment:

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

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

Django

unread,
May 3, 2017, 3:40:26 AM5/3/17
to django-...@googlegroups.com
#28157: Options order is lost in choicefields when mixing grouped and non-grouped
options.
-------------------------------------+-------------------------------------

Reporter: Paul Antropius | Owner: Tim
| Graham
Type: Bug | Status: assigned
Component: Forms | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

* stage: Accepted => Ready for checkin


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

Django

unread,
May 3, 2017, 7:21:58 AM5/3/17
to django-...@googlegroups.com
#28157: Options order is lost in choicefields when mixing grouped and non-grouped
options.
-------------------------------------+-------------------------------------
Reporter: Paul Antropius | Owner: Tim
| Graham
Type: Bug | Status: closed
Component: Forms | Version: 1.11
Severity: Release blocker | Resolution: fixed

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

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

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


Comment:

In [changeset:"d302e2c09c281e6b1e187f704f656e5e79e69246" d302e2c0]:
{{{
#!CommitTicketReference repository=""
revision="d302e2c09c281e6b1e187f704f656e5e79e69246"
Fixed #28157 -- Fixed choice ordering in form fields with grouped and non-
grouped options.

Regression in b52c73008a9d67e9ddbb841872dc15cdd3d6ee01.
}}}

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

Django

unread,
May 3, 2017, 7:28:37 AM5/3/17
to django-...@googlegroups.com
#28157: Options order is lost in choicefields when mixing grouped and non-grouped
options.
-------------------------------------+-------------------------------------
Reporter: Paul Antropius | Owner: Tim
| Graham
Type: Bug | Status: closed
Component: Forms | Version: 1.11

Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"0615601498e6f7354e05498fc589c556f5365280" 06156014]:
{{{
#!CommitTicketReference repository=""
revision="0615601498e6f7354e05498fc589c556f5365280"
[1.11.x] Fixed #28157 -- Fixed choice ordering in form fields with grouped
and non-grouped options.

Regression in b52c73008a9d67e9ddbb841872dc15cdd3d6ee01.

Backport of d302e2c09c281e6b1e187f704f656e5e79e69246 from master
}}}

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

Reply all
Reply to author
Forward
0 new messages