The manual’s example uses a single, self-referencing table. What would be the 
syntax for joined, parent/child tables?  

 

I get an AttributeError. Not sure if the parent_name formation is the problem

 

    roots = db((db.role_member.id > 0) & (db.role_member.object_super_object_fk 
== 
db.object_super_object.id)).select().as_trees(parent_name=db.role_member.object_super_object_fk)
  File 
"C:\alex\alt_web2py_11_new_boot\web2py_win\web2py\gluon\packages\dal\pydal\objects.py",
 line 2470, in as_trees
    drows[row.id] = row
  File 
"C:\alex\alt_web2py_11_new_boot\web2py_win\web2py\gluon\packages\dal\pydal\objects.py",
 line 109, in __getattr__
    raise AttributeError

 

It seems that the solution could be to create a set so there is only one 
record-type:

 

mySet = db((db.role_member.id > 0)  & (db.role_member.object_super_object_fk == 
db.object_super_object.id)).select()

 

Then find some way to make it work within as_trees:

 

roots = db(mySet).select().as_trees(parent_name='mySet.object_super_object_fk')

-- 
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