﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
2265	"[patch] Field's choices can be ""used"" only once if its a generator or an iterator."	Alex Dedul	Adrian Holovaty	"If you have field with an iterator/generator for choices its correct display value could be fetched only once. For example:

{{{
>>> from intranet.orders.models import SSL
>>> s = SSL.objects.get(pk=1)
>>> s.get_country_display()
'Belarus'
>>> s.get_country_display()
'BY'
>>> s.get_country_display()
'BY'
}}}

Its apparent that its because of the nature of iterators that can be ""listed"" only once. Proposed patch to fix this uses itertools.tee for every field.choices that looks like an iterator. Hardly its perfect, cos tee is caching values. Maybe someone could come up with a better solution. 

Also there should be tests for this, but lets see what core devs says for now."	defect	closed	Core (Other)		normal	fixed			Unreviewed	1	0	0	0	0	0
