[Django] #27704: contrib.postgres.ArrayField with choices should use TypedMultipleChoiceField as its default form field class

33 views
Skip to first unread message

Django

unread,
Jan 8, 2017, 6:35:25 PM1/8/17
to django-...@googlegroups.com
#27704: contrib.postgres.ArrayField with choices should use
TypedMultipleChoiceField as its default form field class
--------------------------------------------+------------------------
Reporter: Carl Meyer | Owner: (none)
Type: New feature | Status: new
Component: contrib.postgres | Version: master
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 |
--------------------------------------------+------------------------
Currently the contrib.postgres ArrayField implements no special handling
for choices, which makes it pretty useless with choices; you can specify
your choices as a list of possible arrays for the ArrayField to contain.
This is, I suppose, consistent in some technical sense, but rarely if ever
useful in practice. It's very handy to use an ArrayField with choices to
implement a multiple-choice field. We already have a
`TypedMultipleChoiceField` form field in Django, so the implementation for
this is just a trivial enhancement to the `ArrayField.formfield` method:
if `self.choices` is set, use `TypedMultipleChoiceField` as the form
class, with the `base_field` used to determine the expected type.

Any objections to this before I submit a PR for it?

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

Django

unread,
Jan 9, 2017, 2:52:03 AM1/9/17
to django-...@googlegroups.com
#27704: contrib.postgres.ArrayField with choices should use
TypedMultipleChoiceField as its default form field class
----------------------------------+------------------------------------

Reporter: Carl Meyer | Owner: (none)
Type: New feature | Status: new
Component: contrib.postgres | Version: master
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 Claude Paroz):

* stage: Unreviewed => Accepted


Comment:

Please!

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

Django

unread,
Jan 14, 2017, 5:54:16 AM1/14/17
to django-...@googlegroups.com
#27704: contrib.postgres.ArrayField with choices should use
TypedMultipleChoiceField as its default form field class
----------------------------------+------------------------------------

Reporter: Carl Meyer | Owner: (none)
Type: New feature | Status: new
Component: contrib.postgres | Version: master
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
----------------------------------+------------------------------------

Comment (by Claude Paroz):

See also #27161

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

Django

unread,
Jan 14, 2017, 10:29:41 AM1/14/17
to django-...@googlegroups.com
#27704: contrib.postgres.ArrayField with choices should use
TypedMultipleChoiceField as its default form field class
----------------------------------+------------------------------------

Reporter: Carl Meyer | Owner: (none)
Type: New feature | Status: new
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1
* has_patch: 0 => 1


Comment:

Here is a [https://github.com/django/django/pull/7850 preliminary patch].
Obviously needs some more work, but it's a start...

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

Django

unread,
Mar 29, 2017, 3:04:25 PM3/29/17
to django-...@googlegroups.com
#27704: contrib.postgres.ArrayField with choices should use
TypedMultipleChoiceField as its default form field class
----------------------------------+------------------------------------

Reporter: Carl Meyer | Owner: (none)
Type: New feature | Status: new
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

Comment (by Claude Paroz):

I've updated the patch and clarified the fact that choices should be
defined on the base_field, not on the ArrayField itself. Hopefully it's a
sensible recommendation!

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

Django

unread,
Jun 26, 2020, 9:59:48 AM6/26/20
to django-...@googlegroups.com
#27704: contrib.postgres.ArrayField with choices should use
TypedMultipleChoiceField as its default form field class
----------------------------------+------------------------------------

Reporter: Carl Meyer | Owner: (none)
Type: New feature | Status: new
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

Comment (by Gordon Wrigley):

It would be nice to get this done, it seems such an obvious little change.

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

Django

unread,
Jun 23, 2022, 2:06:21 AM6/23/22
to django-...@googlegroups.com
#27704: contrib.postgres.ArrayField with choices should use
TypedMultipleChoiceField as its default form field class
-------------------------------------+-------------------------------------
Reporter: Carl Meyer | Owner: Anvesh
| Mishra
Type: New feature | Status: assigned
Component: contrib.postgres | Version: dev

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* owner: (none) => Anvesh Mishra
* status: new => assigned


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

Django

unread,
Jun 28, 2022, 4:38:07 PM6/28/22
to django-...@googlegroups.com
#27704: contrib.postgres.ArrayField with choices should use
TypedMultipleChoiceField as its default form field class
-------------------------------------+-------------------------------------
Reporter: Carl Meyer | Owner: Anvesh
| Mishra
Type: New feature | Status: assigned
Component: contrib.postgres | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

Comment (by Anvesh Mishra):

Submitted a [https://github.com/django/django/pull/15805 patch].

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

Django

unread,
Jun 29, 2022, 12:16:58 AM6/29/22
to django-...@googlegroups.com
#27704: contrib.postgres.ArrayField with choices should use
TypedMultipleChoiceField as its default form field class
-------------------------------------+-------------------------------------
Reporter: Carl Meyer | Owner: Anvesh
| Mishra
Type: New feature | Status: assigned
Component: contrib.postgres | Version: dev
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 Mariusz Felisiak):

* needs_better_patch: 1 => 0


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

Django

unread,
Jul 12, 2022, 6:50:29 AM7/12/22
to django-...@googlegroups.com
#27704: contrib.postgres.ArrayField with choices should use
TypedMultipleChoiceField as its default form field class
-------------------------------------+-------------------------------------
Reporter: Carl Meyer | Owner: Anvesh
| Mishra
Type: New feature | Status: assigned
Component: contrib.postgres | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1


Comment:

Per [https://github.com/django/django/pull/15805 Nick's review].

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

Django

unread,
Oct 26, 2022, 1:54:28 PM10/26/22
to django-...@googlegroups.com
#27704: contrib.postgres.ArrayField with choices should use
TypedMultipleChoiceField as its default form field class
-------------------------------------+-------------------------------------
Reporter: Carl Meyer | Owner: Anvesh
| Mishra
Type: New feature | Status: assigned
Component: contrib.postgres | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

Comment (by Anvesh Mishra):

Replying to [comment:9 Mariusz Felisiak]:

Can we have a review over this?

--
Ticket URL: <https://code.djangoproject.com/ticket/27704#comment:10>

Reply all
Reply to author
Forward
0 new messages