On Dec 15, 2011, at 3:29 AM, Chandrakant Kumar wrote:

> I'm adding extra fields to auth_user as,
>       auth.settings.extra_fields['auth_user']= [
>               Field('user_type', requires=IS_IN_SET('Admin', 'Staff'))]
> 
> But, in the Register form I'm getting a listbox with single letter options 
> like, a, d, m, i, n.
> Is there something missing?

The problem with this call is that IS_IN_SET requires the set to be its first 
argument, thus:

        auth.settings.extra_fields['auth_user']= [
                Field('user_type', requires=IS_IN_SET(('Admin', 'Staff')))]

This makes the first argument a tuple, ('Admin', 'Staff'), instead of a string, 
'Admin' (which happens to be iterable, of course).

For readability, you could write IS_IN_SET(['Admin', 'Staff']) or 
IS_IN_SET(tuple('Admin', 'Staff'))

No need to use a dict.

Reply via email to