They are both fine but default cannot be a string, must be 0.

On Oct 21, 6:21 am, Luther Goh Lu Feng <[email protected]> wrote:
> I have the following custom user model. I am trying to reference the 
> membership
> type so that when users are created by administrators, they can assigned
> different roles. Attention to be drawn to the 2 lines commented out at the
> bottom, which I have tried to make the reference but failed. Any tips?
>
> db.define_table(auth.settings.table_user_name,
>     Field('username', 'string', length=255, required=True,
> requires=IS_NOT_EMPTY(), unique=True, label="Username"),
>     Field('first_name', 'string', length=255, required=True,
> requires=IS_NOT_EMPTY(), label="First name"),
>     Field('last_name', 'string', length=255, required=True,
> requires=IS_NOT_EMPTY(), label="Last name"),
>     Field('password', 'password', length=40, required=True,
> requires=[IS_NOT_EMPTY(),CRYPT(key="sha1:theultimatesuperrover")],
>  readable=False,  label="Password"),
>     Field('last_login', 'datetime', writable=False, readable=False,
> update=request.now),
>     Field('registration_key', length=512, writable=False, readable=False,
> default=''),
>     Field('reset_password_key', length=512, writable=False, readable=False,
> default=''),
>     Field('registration_id', length=512, writable=False, readable=False,
> default=''),
>     Field('class_id', 'reference classes', default=''),
>     #Field('membership_id', db.auth_membership, default=''),
>     #Field('membership_id', auth.settings.table_membership, default=''),
>     format='%(username)s'
> )

Reply via email to