Hi,
i've defined the following relations:
db.define_table('users_dictionaries',
Field('user_id', db.auth_user, requires =
IS_IN_DB(db,'auth_user.id', db.auth_user._format)),
Field('dictionary_id', db.dictionary,
requires=IS_IN_DB(db,'dictionary.id',db.dictionary._format)),
)
db.define_table('users_categories',
Field('user_id', db.auth_user, requires =
IS_IN_DB(db,'auth_user.id', db.auth_user._format)),
Field('category_id', db.category,
requires=IS_IN_DB(db,'category.id',db.category._format)),
)
i then created a grid=SQLFORM.smartgrid(db.auth_user) and i can see the
many-to-many relations i can navigate on them but when i try to add one
i get:
Traceback(most recent call last):
File"/var/www/argomenti.in/web2py/gluon/restricted.py",line194,inrestricted
execccodeinenvironment
File"/var/www/argomenti.in/web2py/applications/webkeywords2/controllers/admin.py"
<http://localhost:8000/admin/default/edit/webkeywords2/controllers/admin.py>,line13,in<module>
File"/var/www/argomenti.in/web2py/gluon/globals.py",line149,in<lambda>
self._caller=lambdaf:f()
File"/var/www/argomenti.in/web2py/gluon/tools.py",line2456,inf
returnaction(*a, **b)
File"/var/www/argomenti.in/web2py/applications/webkeywords2/controllers/admin.py"
<http://localhost:8000/admin/default/edit/webkeywords2/controllers/admin.py>,line6,inindex
grid=SQLFORM.smartgrid(db.auth_user)
File"/var/www/argomenti.in/web2py/gluon/sqlhtml.py",line1821,insmartgrid
user_signature=user_signature,**kwargs)
File"/var/www/argomenti.in/web2py/gluon/sqlhtml.py",line1668,ingrid
value=field.represent(value,rrow)
File"/var/www/argomenti.in/web2py/gluon/sqlhtml.py",line1808,in<lambda>
field.represent=lambdaid,r=None,referee=referee,rep=field.represent:A(rep(id),_href=URL(args=request.args[:args]+['view',referee,id],user_signature=user_signature))
TypeError:'NoneType'objectis notcallable
The problem is rep() being None but the documentation about
field.represent says:
|represent| can be None or can point to a function that takes a field value
and returns an alternate representation for the field value.
So it can be None or a function.... how can i fix it?
--
Vincenzo Ampolo
http://vincenzo-ampolo.net
http://goshawknest.wordpress.com