web2py Shell 2.9.5-stable+timestamp.2014.03.16.02.35.39
In [1] : tos = db(db.auth_criteria.toSend ==1).select()
In [2] : tos
<Rows (1)>
In [3] : for row in tos:
print row.user_id.email
Traceback (most recent call last):
File "/Users/LaViez/Documents/Python/web2py/gluon/contrib/shell.py", line
234, in run
exec compiled in statement_module.__dict__
File "<string>", line 2, in <module>
AttributeError: 'long' object has no attribute 'email'
Hi, the above is my error. Spent a few hours and couldn't figure out...
my db.py:
db.define_table('auth_criteria',
Field('user_id', 'reference auth_user',requires = IS_IN_DB(db,
'auth_user.id'), readable=False, writable=False),
Field('salePrice', 'integer', widget=SQLFORM.widgets.radio.widget,
requires = IS_IN_SET(salePrice)),
Field('toSend','integer', readable=False, writable=False))
db.auth_criteria.id.readable=False
In my appadmin interface, I can tell the "user_id" field IS indeed linked
to auth_user, since I can click the auth_criteria "user_id" field, it will
direct me to auth_user table.
But I cannot get any recursive attribute in the run as the error shows.
Btw, I find some inconsistency in the book 6th edition.
In the Overview section:
db.post.image_id.requires = IS_IN_DB(db, db.image.id, '%(title)s')
But in DAL section:
db.thing.owner_id.requires = IS_IN_DB(db,'person.uuid','%(name)s')
It seems both will link the tables. But none gave me the "email" or
"first_name" attributes in recursive selection.
Thanks for any help.
--
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/d/optout.