def roles_index(): form = SearchForm() roles = Role.query.all() if form.validate_on_submit(): search = form.search.data roles = Role.query.filter((Role.name.like('%'+search+'%'))).all() return render_template('roles/index.html',form=form,roles=roles)
def reservations_index(): form = SearchForm(request.form) reservations = Reservation.query.all() if form.validate_on_submit(): search = form.search.data reservations = Reservation.query.filter(or_( Reservation.amount.like('%'+search+'%'), Reservation.passenger_id.like('%'+search+'%'))).all() return render_template('reservations/index.html',form=form,reservations=reservations)
def rooms_index(): form = SearchForm() rooms = Rooms.query.all() if form.validate_on_submit(): search = form.search.data rooms = Rooms.query.filter(or_( Rooms.room_type.like('%'+search+'%'), Rooms.status.like('%'+search+'%'), Rooms.price.like('%'+search+'%'))).all() return render_template('rooms/index.html', form = form, rooms=rooms)
def users_index(): form = SearchForm() users = User.query.all() if form.validate_on_submit(): search = form.search.data users = User.query.filter(or_( User.firstname.like('%'+search+'%'), User.lastname.like('%'+search+'%'), User.mobile.like('%'+search+'%'), User.role.like('%'+search+'%'), User.email.like('%'+search+'%'))).all() return render_template('users/index.html', form = form, users=users)