I have problem, I would like to have achieve a query which displays the
value of the foreign key:
db.define_table("owner", Field("owner_name"))
db.define_table("dog", Field("dog_name"), Field("owner", "reference owner"))
rs = db(db.owner.id==db.dog.owner).select(db.owner.name, db.owner.name)
what i want to result set to be is:
is a list of dictionaries with {"fieldname":"value"} in this case have
[{"owner_name": "Paul"}, {"dog_name", "Snoopy"}],
[{"owner_name": "Ben"}, {"dog_name", "Poopy"}],
...
...
how do i iterate through my record set "rs" above cause i am having
challenges if i do it like this:
for row in rs:
for k, v in (row.as_dict()).items():
print '>', k,' and ', v
I am getting weird results!
Any help?
--
.......................................................................................
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA
Cell: +260 97 7760473
website: http://www.opensource.org.zm
~/
Human Knowledge belongs to the world! - AntiTrust
Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881
/~
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.