Hello I am having a seemingly difficult time with this :-) and I am hoping some one can aid in solving this :-)
I am trying to make an item reserved from start-date to end-date any ideas *cheers here is my code This my latest attempt googled and found this function import datetime def daterange( start_date, end_date ): if start_date <= end_date: for n in range((end_date - start_date).days + 1): yield start_date + datetime.timedelta(n) else: for n in range((start_date - end_date).days + 1): yield start_date - datetime.timedelta(n) then in my web2py code I have @auth.requires(auth.has_membership('second_year') or auth.has_membership('admin')) def second_year_checkout(): check_id = request.args(0) check = db(db.product.id == check_id).select() project_date = db(db.checkout.id>0).select() for valid in check: db.checkout.product.default=valid.id form = SQLFORM(db.checkout) if form.process().accepted: for project in project_date: start = project.date_in end = project.date_out for date in daterange(start, end): if date: session.flash = 'form accepted' return dict(redirect(URL('default', 'next'))) else: return dict(redirect(URL('error','availability'))) elif form.errors: response.flash = 'form has errors' else: response.flash = 'please fill the form' return dict(form=form) *cheers and ty Andrew --