On Thu, Mar 19, 2009 at 10:32 PM, weheh <[email protected]> wrote:

>
> I need some help with a validator for my test db.
>
> Here's my model:
>
> db.define_table('test',
>  SQLField('parent','reference dset'),
>  SQLField('name','string')
> )
>
> I want a validator that says that the default test.parent value should
> be 0 and that the allowed values are 0 and any other value that
> IS_IN_DB(db,'test.id','%(name)s').


is this what you mean:

db.test.parent.requires=IS_NULL_OR(IS_IN_DB(....))



> It would also be nice if "No parent" could be the name for the id=0.
>
> OR is the best way to do this simply to declare a root node with
> test.id==1? Somehow, I don't like this idea as much.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to