Thanks Niphlod! Will try that. Yes. Mysql with INNODB. I am loading the
courses manually but wanted to do it via the web2py form...
El martes, 18 de febrero de 2014 17:24:25 UTC-3, Niphlod escribió:
>
> does your backend support a foreign key with a null value ? not all of
> them can.
> As an alternative, you can
>
> Field('awc_pro_id', 'integer', requires=IS_EMPTY_OR(IS_IN_DB(....)))
>
> On Monday, February 17, 2014 7:21:14 PM UTC+1, brahama von wrote:
>>
>> Hi,
>>
>> dunno why my previous post didn't make it. Here it goes.
>>
>> part of my model
>>
>> legacy_db.define_table('courses',
>> Field('awc_name','string'),
>> Field('awc_version','string'),
>> Field('awc_link','string'),
>> Field('awc_pro_id',legacy_db.project, required=False, default=None),
>> Field('awc_cli_id',legacy_db.client),
>> format='%(awc_name)s',
>> migrate=False)
>>
>> While creating a form for insert new courses i get the validator error;
>> "value not in database"
>>
>> While this is true, i allow that value to be NULL in DB. How can i allow
>> that in the form and insert the record?
>>
>>
>> controller
>>
>> form=SQLFORM(legacy_db.courses)
>> if form.process().accepted:
>> response.flash = 'Course was added Correctly'
>> return dict(form=form,message=T('Edition for Courses'))
>>
>>
>> Thanks!
>>
>
--
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/groups/opt_out.