I'm trying to get IS_IN_SET to sort options numerically for the following
validator:
db.sponsor.pledge_amount.requires = IS_IN_SET({
50: '$50 per lap',
25: '$25 per lap',
10: '$10 per lap',
5: '$5 per lap',
2: '$2 per lap',
1: '$1 per lap',
0: 'Flat amount'
}, sort=True)
It sorts the options using a string comparison so they end up like this:
$1 per lap
$10 per lap
$2 per lap
$25 per lap
$5 per lap
$50 per lap
Flat amount
IS_IN_SET seems to use a hard set *options_sorter* in validators.py instead
of taking a lambda. Any ideas on how to customize the sorting?
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.