Hold your hat:-)
I have an SQLFORM.smartgrid with 'dog' as the main table and 'puppy' as the 
linked_table  that has a reference to the 'dog' table.
This will add an extra columne with a link 'puppy' on each dog row in the 
the dog grid. Clicking on that link
will show a new grid containing rows with only the puppies with reference 
to the specific dog row from the dog grid.
So far so good. Now : the dog table has a reference to the auth_user table 
 and the grid has a constraint 
: constraints={'dog':db.dog.owner==auth.user},
This also works fine: I get only the dogs of the currently logged in user. 
Clicking on the puppy link(mentioned above) in the dog grid brings up the 
puppy grid. clicking on an Edit button on one of the puppies row
brings up the edit form for this puppy. One of the fields in the edit form 
is a drop down list with dogs so I can assign the puppy to another dog. THE 
PROBLEM is that the list contains ALL the dogs
in the dog table instead of only the dogs of the current user. 
Help will be greatly appreciated

db.define_table('dog,
                Field('name')
                Field('owner',db.auth_user)
db.define_table('puppy',
                Field('name')
                Field('dog',db.dog)

grid = SQLFORM.smartgrid(db.dog,linked_tables=['puppy'],
                        constraints={'dog':db.dog.owner==auth.user},

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