Here is example code to show what I am doing.
The following is in model/db.py:
db.define_table('item_type',
Field('name'),
Field('description'),
format='%(name)s'
)
db.define_table('item',
Field('name'),
Field('description'),
Field('item_type'),
format='%(name)s'
)
db.item.item_type.requires = IS_IN_DB(db, db.item_type, '%(name)s',
orderby='name')
# example fixtures
if db(db.item_type).isempty():
db.item_type.insert(name='Type1')
db.item_type.insert(name='Type2')
db.item_type.insert(name='Type3')
db.item_type.insert(name='Type10')
db.item_type.insert(name='Type20')
db.item_type.insert(name='Type30')
db.item_type.insert(name='Type99')
I go to the appadmin/database administration page and under db.item I click
on the 'New Record' button.
In the form in the page
(http://127.0.0.1:8000/naturalsort/appadmin/insert/db/item) , the drop down
displays the item_type as following:
Type1
Type10
Type2
Type20
Type3
Type99
What do I put in the 'orderby' parameter to make the item type list like
the following:
Type1
Type2
Type3
Type10
Type20
Type30
Type99
[Please use the above code to show in example what to do]
-rppowell
On Saturday, May 11, 2013 4:47:34 AM UTC-7, Niphlod wrote:
>
> IS_IN_DB accepts a "orderby" parameter.....
--
---
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.