yes. This should clarify it.
if db.mytable.myfield.type[:10]='reference ':
print db.mytable.myfield,'referenced',db.mytable.myfield.type[10:]
for item in db.mytable.referenced_by:
print db.mytable.id, 'referenced by field', item[1], 'in table',
item[0]
Massimo
On Mar 25, 1:30 pm, Kent Borg <[email protected]> wrote:
> I am wondering how to implement a more free-form search. For example, a
> search for "will" would get a direct hit on someone named "Robin
> Williams", but say I have a reference out to favorite movie in another
> table, I also want to find someone else who points to "Good Will
> Hunting" in that over table.
>
> I can certainly hard code all the fields to search and all the joins
> necessary to get to those fields, but I was hoping for some
> introspective help to make the search less brittle.
>
> Given a starting table I can see the fields in that table
> (db.person.fields), but is there a good way to get from
> db.person.favorite_movie to db.movies? Looking at SQLFORM() sources it
> seems to get it from the SQLField object. I don't know that I should be
> poking inside there...
>
> Suggestions?
>
> Thanks,
>
> -kb
>
> P.S. Once I figure out how to do this introspection I expect I don't
> want to search everything I can crawl to from the starting table; I am
> also wondering how to say something about what joins to make and what
> fields to look at when getting to the next table...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---