db.TreeStructure.parentID.requires=IS_NULL_OR(IS_IN_DB(db, 'TreeStructure.id'))
On Mar 12, 4:40 am, Jurgis Pralgauskis <jurgis.pralgaus...@gmail.com> wrote: > by the way, to be able in db admin > to have dropdown reference to entered records (trunk/branches) > I need to have > db.TreeStructure.parentID.requires=IS_IN_DB(db, 'TreeStructure.id') > > but that is problem if I am creating the first (root) element > (as workaround I commented out the IS_IN_DB line for this task, > or could add it in code at some init stage) > > but would it be hard to make a drop-down binding, only when there are records > and leave integer box if there are none..? > I have web2py 1.56.4 (but didn't notice in158 changelog address this issue) > > > > On Fri, Mar 6, 2009 at 3:35 AM, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > Your suggestions works but it will not be enforced at the database > > level: > > > I suggest instead > > > db.define_table("TreeStructure", > > SQLField("name", "string",notnull=True, default=None), > > SQLField("parentID", "reference TreeStructure")) > > > Massimo > > > On Mar 5, 4:40 pm, DenesL <denes1...@yahoo.ca> wrote: > >> db.define_table("TreeStructure", > >> SQLField("name", "string",notnull=True, default=None), > >> SQLField("parentID", "integer")) > > >> db.TreeStructure.parentID.type="reference TreeStructure" > > -- > Jurgis Pralgauskis > tel: 8-616 77613; > jabber: jur...@akl.lt; skype: dz0rdzas; > Don't worry, be happy and make things better ;)http://sagemath.visiems.lt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---