db.define_table('company',
Field('name', 'string', length=20, represent=lambda name, row: name.
capitalize(), required=True,
unique=True, notnull=True,
requires=[IS_NOT_EMPTY(error_message='You must enter a company name'),
IS_MATCH('^[a-zA-Z0-9][a-zA-Z0-9 ,-.]*$')
]),
Field('user_id', 'reference auth_user', ondelete='NO ACTION', label='User',
writable=False, readable=False,
),
Field('is_default', 'boolean', writable=False),
address,
format=lambda r: r.name or 'No name company')
db.company.name.requires = IS_NOT_IN_DB(db, db.company.name,
error_message='This
company name is in use')
db.company.country.widget=SQLFORM.widgets.autocomplete(request, COUNTRIES,
limitby=(0,10), min_length=2)
I get
>
> <type 'exceptions.AttributeError'> 'tuple' object has no attribute
> 'tablename'
COUNTRIES is just a list of strings
Thanks
>
On Wednesday, 30 April 2014 09:22:38 UTC, Johann Spies wrote:
>
> On 28 April 2014 21:38, Miguel Andrés Moya Rojas <[email protected]
> <javascript:>> wrote:
>
> Hello! My issue is this: I want to use the autocomplete widget (
>> SQLFORM.widgets.autocomplete) but my field is a list:string, and now it
>> shows all data in only one field, resulting in an awkward input. How can I
>> use this widget with a list:string field? Thanks in advance. :)
>>
>>
> And your code is ...?
>
> Regards
> Johann
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you. (Psalm 63:3)
>
--
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.