Reputation: 61
I have recently updated FormAlchemy to the newest version 1.5.3.
Up to now my select tags were created like this:
helpers.select(self.name, value, variants, class_="form-control")
where variants is a list e.g.:
['created', 'edited', 'published', 'rejected', 'unpublished']
and were working fine.
After the update all my selects contains only first two options with reversed order.
The source code of helpers.py (https://github.com/FormAlchemy/formalchemy/blob/master/formalchemy/helpers.py) shows in the line 185 it is a correct behaviour (at least according to the code I can see there). But why? What should I do to display all my options again?
Upvotes: 0
Views: 21
Reputation: 61
Lists and tuples are not allowed as a select options anymore. It must be a dictionary of value:index pairs.
This additional line will do the job:
variants = dict((el,index) for index,el in enumerate(variants))
Upvotes: 0