Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#12215 closed (fixed)

ModelChoiceIterator doesn't define __len__

Reported by: Alex Gaynor Owned by: Karen Tracey
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

This means one can't necessarily call len(field.choices) if hasattr(field.choices), which would be nice.

Attachments (3)

modelchoice_iterator_len.diff (1.6 KB) - added by Alex Gaynor 7 years ago.
modelchoice_iterator_len.2.diff (1.6 KB) - added by Alex Gaynor 7 years ago.
modelchoice_iterator_len.3.diff (1.4 KB) - added by Tobias McNulty 7 years ago.
same patch w/extra whitespace removed

Download all attachments as: .zip

Change History (11)

comment:1 Changed 7 years ago by Alex Gaynor

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Changed 7 years ago by Alex Gaynor

Changed 7 years ago by Alex Gaynor

comment:2 Changed 7 years ago by kgrandis

Owner: changed from nobody to kgrandis
Status: newassigned

comment:3 Changed 7 years ago by kgrandis

Has patch: set
Owner: changed from kgrandis to nobody
Status: assignednew

Changed 7 years ago by Tobias McNulty

same patch w/extra whitespace removed

comment:4 Changed 7 years ago by Tobias McNulty

Triage Stage: UnreviewedAccepted

Applied and tested; works fine.

Seems like a small, intuitive change to me and not something anyone would complain about. It doesn't look like we document ModelChoiceIterator anyways, so this probably doesn't need docs.

Marking Accepted but it's probably RFC.

comment:5 Changed 7 years ago by Jeremy Dunck

Triage Stage: AcceptedReady for checkin

comment:6 Changed 7 years ago by Tobias McNulty

Owner: changed from nobody to Karen Tracey

comment:7 Changed 7 years ago by Karen Tracey

Resolution: fixed
Status: newclosed

(In [11850]) Fixed #12215: Added len to ModelChoiceIterator. Thanks Alex and Tobias.

comment:8 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top