'reference bursary_users' and requires = [IS_IN_DB(db, 'bursary_users
.barcode')]  - I think, that  it's mutually exclusive requirements 
'reference bursary_users' == requires = IS_IN_DB(db, 'bursary_users.*id*')







On Friday, October 14, 2016 at 6:21:38 PM UTC+3, James Booth wrote:
>
> Hey guys,
>
> Excuse me if I'm missing something (or a lot), but I'm pretty experienced 
> with web2py.
>
> I have the following defined in my model:
>
> db.define_table('bursary_users',
>>                 Field('forename', type='string', requires=IS_NOT_EMPTY()),
>>                 Field('surname', type='string', requires=IS_NOT_EMPTY()),
>>                 Field('studentId', type='string', 
>> requires=IS_NOT_EMPTY(), unique=True),
>>                 Field('barcode', type='string', requires=IS_NOT_EMPTY(), 
>> unique=True),
>>                 Field('email', type='string', requires=IS_EMAIL(), 
>> unique=True),
>>                 Field('bursary', requires=IS_IN_SET(['Free school 
>> meals','Bursary','Disabled'])),
>>                 Field('notes', type='text'),
>>                 format='%(studentId)s'
>> )
>> db.define_table('bursary_entries',
>>                 Field('barcode', 'reference bursary_users', requires = 
>> [IS_IN_DB(db, 'bursary_users.barcode')]),
>>                 Field('entry_date', type='datetime', default=request.now, 
>> readable=False, writable=False),
>>                 format='%(barcode)s'
>> )
>
>
> When I use the SQLFORM on a page, I can enter a barcode and it validates 
> it (Fails if not in bursary_users, pass if it is). However, when I come to 
> check the database, I'm getting a '0' (Althought it is hyperlinked to 
> nothing) for the barcode value and a correct value for the entry_date.
>
> Any ideas why this is happening?
>
> Kind regards,
> James. 
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to