Hi,
I am not sure i follow your question 100%. Is this what you need?
db.define_table('stuff',
Field('nombre', 'string',
requires=IS_NOT_EMPTY()),
format='%(nombre)s')
On Saturday, March 14, 2015 at 2:33:13 PM UTC-7, Phil Hughes wrote:
>
> I seem to be in a loop (me, not the computer) getting autocomplete to do
> what I want which is totally basic. I have reduced this to a test case and
> could use a push in the right direction. (Consider this one of my 20
> variations.)
> What I want is for the reference lookup to use nombre (not the ID field)
> in autocomplete.
>
> Thanks.
>
> MODEL
> db.define_table('stuff',
> Field('nombre', 'string', requires=IS_NOT_EMPTY())
> )
>
> db.define_table('reel',
> Field('whatever', 'string', requires=IS_NOT_EMPTY()),
> Field('sid', 'reference stuff')
> )
>
> CONTROLLER
> def stuff():
> grid = SQLFORM.grid(db.stuff, user_signature=False)
> return locals()
>
> def reel():
> grid = SQLFORM.grid(db.reel, user_signature=False)
> db.reel.sid.widget = SQLFORM.widgets.autocomplete(
> request, db.reel.sid, id_field=db.stuff.nombre)
> return locals()
>
>
--
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/d/optout.