id = final_attrs['id']
del final_attrs['id']
- # Insert blank value
- choices = [('','---')] + list(choices)
+ # Insert blank value. We insert this in self.choices, because
+ # render_options merges self.choices with its choices argument
+ # (in that order) and we want to have the empty option at the
+ # top.
+ old_choices = self.choices
+ self.choices = [('','---')] + list(self.choices)
# Build values
items = []
script = TPL_SCRIPT %{'id': id}
output = TPL_FULL %{'id': id, 'values': '\n'.join(items), 'script': script}
+
+ # Restore the original choices
+ self.choices = old_choices
return mark_safe(output)