[Django] #25731: Remove choices from ether instance or method attribute in Select widget

12 views
Skip to first unread message

Django

unread,
Nov 11, 2015, 7:46:54 AM11/11/15
to django-...@googlegroups.com
#25731: Remove choices from ether instance or method attribute in Select widget
--------------------------------------+--------------------
Reporter: codingjoe | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Forms | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
`django.forms.widgets.Select` chains `self.choices` a kwarg `choices`.

I think this is a bit over the top, and results in a lot of complexity. I
couldn't find a good reason to why this is actually implemented that way.

I'd like to drop one of the two. Ether remove the choices from the
instance and keep passing them in all methods, or preferable remove them
from the method signatures.
The latter I think is cleaner but does include a bit of deprecation.

Cheers,
Joe

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

Django

unread,
Nov 11, 2015, 9:52:21 AM11/11/15
to django-...@googlegroups.com
#25731: Remove choices from ether instance or method attribute in Select widget
-------------------------------------+-------------------------------------
Reporter: codingjoe | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Forms | Version: 1.8
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
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

It's a bit difficult for me to evaluate the ticket without some working
code. Upon working on it, you might find the reason for the current
implementation. Can you provide a patch?

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

Django

unread,
Nov 11, 2015, 10:42:35 AM11/11/15
to django-...@googlegroups.com
#25731: Remove choices from ether instance or method attribute in Select widget
-------------------------------------+-------------------------------------
Reporter: codingjoe | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Forms | Version: 1.8
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
-------------------------------------+-------------------------------------

Comment (by codingjoe):

Tim, I could work on a patch, but I'd like to make a design decision
first.

As I see it, the only reason why there is the option to pass choices into
the renderer directly is the `ModelChoiceIterator`.
Where the regular choices get cast into a list, this would be a very poor
idea for the `ModelChoiceIterator`.

The question is, should we allow Widgets to be rendered multiple times and
drop the instance attribute, or should we not.
Another option would be to deepcopy the choices when they're being
rendered.

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

Django

unread,
Nov 12, 2015, 10:02:58 AM11/12/15
to django-...@googlegroups.com
#25731: Remove choices from ether instance or method attribute in Select widget
-------------------------------------+-------------------------------------
Reporter: codingjoe | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Forms | Version: 1.8
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
-------------------------------------+-------------------------------------

Comment (by timgraham):

I think it's very likely that some users render widgets multiple times on
a page for whatever reason, so I don't think removing that functionality
is an option.

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

Django

unread,
Nov 17, 2015, 12:23:31 PM11/17/15
to django-...@googlegroups.com
#25731: Remove choices from ether instance or method attribute in Select widget
-------------------------------------+-------------------------------------
Reporter: codingjoe | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Forms | Version: 1.8
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => needsinfo


Comment:

Please reopen if you can provide a patch, otherwise I'm not sure how to
proceed with this ticket.

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

Django

unread,
Jan 24, 2016, 11:29:48 PM1/24/16
to django-...@googlegroups.com
#25731: Remove choices from ether instance or method attribute in Select widget
-------------------------------------+-------------------------------------
Reporter: codingjoe | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Forms | Version: 1.8
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by jpic):

Agreed that this part is a bit fuzzy, seems like a leftover from before a
refactor.

I do not see any valid use case for this argument, why would a user put so
much effort into appending options that won't validate to a select widget
?

Patch proposed: https://github.com/django/django/pull/6037

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

Django

unread,
Jan 24, 2016, 11:58:43 PM1/24/16
to django-...@googlegroups.com
#25731: Remove choices from ether instance or method attribute in Select widget
-------------------------------------+-------------------------------------
Reporter: codingjoe | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Forms | Version: 1.8
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by jpic):

* cc: jpic (added)


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

Django

unread,
Jan 25, 2016, 10:22:38 AM1/25/16
to django-...@googlegroups.com
#25731: Remove choices from ether instance or method attribute in Select widget
-------------------------------------+-------------------------------------
Reporter: codingjoe | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Forms | Version: 1.8
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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

In [changeset:"65c13f9675d2ca7fc1c925e7182a2e35d07ff5fb" 65c13f96]:
{{{
#!CommitTicketReference repository=""
revision="65c13f9675d2ca7fc1c925e7182a2e35d07ff5fb"
Refs #25731 -- Removed unused MultipleHiddenInput choices
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25731#comment:7>

Django

unread,
Feb 1, 2016, 8:13:48 AM2/1/16
to django-...@googlegroups.com
#25731: Remove choices from ether instance or method attribute in Select widget
--------------------------------------+------------------------------------

Reporter: codingjoe | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Forms | Version: 1.8
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 timgraham):

* status: closed => new
* has_patch: 0 => 1
* resolution: needsinfo =>
* stage: Unreviewed => Accepted


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/25731#comment:8>

Django

unread,
Feb 2, 2016, 6:04:28 PM2/2/16
to django-...@googlegroups.com
#25731: Remove choices from ether instance or method attribute in Select widget
--------------------------------------+------------------------------------
Reporter: codingjoe | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Forms | Version: 1.8
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: new => closed

* resolution: => fixed


Comment:

In [changeset:"926e90132dc15d76bb8d16e2f9f1279566cac3c3" 926e9013]:
{{{
#!CommitTicketReference repository=""
revision="926e90132dc15d76bb8d16e2f9f1279566cac3c3"
Fixed #25731 -- Removed unused choices kwarg for Select.render()
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25731#comment:9>

Reply all
Reply to author
Forward
0 new messages