Hi,
First time i write to the list. Been googling around and couldn't find a
solution that i understand. I am really new to python and web2py.
I have this model
legacy_db.define_table('courses',
Field('name','string'),
Field('version','string'),
Field('link','string'),
Field('pro_id',legacy_db.project),
Field('cli_id',legacy_db.client),
format='%(name)s',
migrate=False)
NOTE: The pro_id field in the DATABASE (mysql) references the project table
via FK. It allows NULL values as the only mandatory field should be client.
So i added the courses through phpmyadmin correctly with the pro_id set to
NULL to various courses.
I created a controller to insert/edit that table so if someone wants to add
a course can do it without having access to admin or to DB.
def edit_courses():
form=SQLFORM(legacy_db.courses)
if form.process().accepted:
response.flash = 'Course was added Correctly'
return dict(form=form,message=T('Edition for Courses'))
View
----------------
{{extend 'layout.html'}}
<h1>{{=message}}</h1>
{{=form}}
So the issue comes when i insert a course with no pro_id field. Validators
assume that one of the referenced values whould be used. And don't know how
to put NULL which should be the case here.
Thanks for the help.
--
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.