it's work well, thank you very much anthony.
it seems the 'represent' can't work in validators : requires. actually i'm
also want the represent format in the form too. when i try to use the
represent in requires an error is occured. did you know how to do it in
requires field?
when using :
db.booking.room.requires=IS_IN_DB(db(db.room.status=='Available'),
db.room.id,
represent=lambda id, r: '%s %s' %
(r.room.branch.address, r.room.room_no))
Traceback
1.
2.
3.
4.
5.
6.
7.
Traceback (most recent call last):
File "/home/stifank/Desktop/web2py/gluon/restricted.py", line 212, in
restricted
exec ccode in environment
File
"/home/stifank/Desktop/web2py/applications/hotel/models/db_wizard_requires.py",
line 57, in <module>
represent=lambda id, r: '%s %s' % (r.room.branch.address, r.room.room_no))
TypeError: __init__() got an unexpected keyword argument 'represent'
when using :
db.booking.room.requires=IS_IN_DB(db(db.room.status=='Available'),
db.room.id,
lambda id, r: '%s %s' %
(r.room.branch.address, r.room.room_no))
Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
Traceback (most recent call last):
File "/home/stifank/Desktop/web2py/gluon/restricted.py", line 212, in
restricted
exec ccode in environment
File "/home/stifank/Desktop/web2py/applications/hotel/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/futsal/controllers/default.py>, line
181, in <module>
File "/home/stifank/Desktop/web2py/gluon/globals.py", line 194, in <lambda>
self._caller = lambda f: f()
File "/home/stifank/Desktop/web2py/gluon/tools.py", line 2971, in f
return action(*a, **b)
File "/home/stifank/Desktop/web2py/applications/hotel/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/futsal/controllers/default.py>, line
99, in booking
editable=has_membership, deletable=has_membership)
File "/home/stifank/Desktop/web2py/gluon/sqlhtml.py", line 2084, in grid
search_menu = SQLFORM.search_menu(sfields, prefix=prefix)
File "/home/stifank/Desktop/web2py/gluon/sqlhtml.py", line 1663, in
search_menu
for k,v in field.requires.options()],
File "/home/stifank/Desktop/web2py/gluon/validators.py", line 545, in options
self.build_set()
File "/home/stifank/Desktop/web2py/gluon/validators.py", line 542, in
build_set
self.labels = [self.label(r) for r in records]
TypeError: <lambda>() takes exactly 2 arguments (1 given)
--
---
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.