Hi! I would like to display a value from places.address instead of
place_id (which is from table rooms; look at the last line). Is it
possible using IS_IN_DB or I have to use other mechanism? Here's the
code from my model file:


db.define_table('places',
                SQLField('address','string', length=40))
db.places.address.requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB
(db,'places.address')]

db.define_table('rooms',
                SQLField('number','string'),
                SQLField('place_id',db.places))

db.rooms.number.requires=[IS_NOT_EMPTY(),
                          IS_NOT_IN_DB(db
(db.rooms.place_id==request.vars.place_id),'rooms.number',
                                       error_message='Taki pokoj juz
istnieje')]
db.rooms.place_id.requires=IS_IN_DB(db,'places.id', 'places.address')

db.define_table('admins',
                SQLField('first_name','string'),
                SQLField('surname','string'),
                SQLField('room_id',db.rooms),
                SQLField('email'),
                SQLField('phone_stationary','string'),
                SQLField('phone_mobile','string'))
db.admins.first_name.requires=db.admins.surname.requires=IS_NOT_EMPTY
()
db.admins.room_id.requires=IS_IN_DB(db,'rooms.id','%(number)s / %
(place_id)s')

I want the items like "12a / Example Street" to appear in dropdown on
the form.
Do you have any ideas?

regards,
mika
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to