klipstein/dojango — Issue #65: 65 - Feature request: Allow ComboBox to re-display manually entered values 
Author: klipstein
Created: 2011-11-06 13:03:24+00:00
State: open

What steps will reproduce the problem?
1. Create a ComboBox with some pre-defined choices
2. In the resulting webpage enter something not in those choices
3. If the field is redisplayet, the manually entered value is not in the list of choices, and will hence not be shown to the user (even though it was accepted when he entered it)

Possible implementation:

Override the render_options-method in the ComboBox widget:

def render_options(self, choices, selected_choices):
display_choices = [ (choice, choice) for choice in selected_choices
if choice and not choice in [ given_choice[0] for given_choice in chain(self.choices, choices) ]
] + list(choices)
return super(ComboBox, self).render_options(display_choices, selected_choices)

This works for me.

Original link: http://code.google.com/p/dojango/issues/detail?id=65