To allow multiple room booking I would change the tables as follows: db.define_table('room', Field('name','string'), Field('ubication','string'), format='%(name)s' )
db.define_table('booking', Field('room','list:reference room'), Field('host','string'), Field('approved','boolean',default=False) ) then in validate you have to select the bookings that have approval pending for processing. In your index function set db.booking.approved.writable = False to avoid it being changed there, or even db.booking.approved.readable = False Also it is not clear who host can be. Another table?. A user that is logged in?. You can use the one included by default and decorate booking with @auth.requires_login() . On Mar 7, 7:09 pm, Ialejandro <ialejandr...@gmail.com> wrote: > Hi again! Playing again with my hotel booking sys I have a new > doubt... > > I have this model: > > db.define_table('room', > Field('name','string), > Field('ubication','string')) > > db.define_table('booking', > Field('room',db.room), > Field('host','string')) > > So I have this controller: > > def index(): > form = crud.create(db.booking, next = URL('validate')) > return dict(form=form) > > def validate(): > > return dict() > > def view(): > > #here I have all the code to show the made bookings in powertable > > return dict(table=table) > > And this is what I'd like to do: > > - A user gets into ~/index and can make a book of MULTIPLE rooms > (currently with the above code I can only book one room at a time). > > - When a user clicks on the submit button, I need to sent an email to > a room manager, so he can validate the booking. If it proceeds it > will be saved and shown in powertable, if not, nothing is saved. How > could I do it?? Do I need to catch the data before saving it? > > (I think I need something like this > auth.settings.registration_requires_approval = True, in fact how could > I do this???) > > Thanks!!! > > (sorry if there are too many questions)