def updatroom(room_id): room = Room.query.get(room_id) form = AddRoom() if form.validate_on_submit(): room.title = form.title.data room.description = form.description.data room.price = form.price.data room.home_img = form.home_img.data room.img1_url = form.img1_url.data room.img2_url = form.img2_url.data room.img3_url = form.img3_url.data db_session.commit() flash('Your Room Has been Updated !', 'success') return redirect(url_for('administration.rooms', room_id=room.id)) elif request.method == 'GET': form.title.data = room.title form.description.data = room.description form.price.data = room.price form.home_img.data = room.home_img form.img1_url.data = room.img1_url form.img2_url.data = room.img2_url form.img3_url.data = room.img3_url return render_template('/administration/addroom.html', form=form, title='Update Room', legend='Update Post')
def upevents(events_id): events = Event.query.get(events_id) form = Moreevent() if form.validate_on_submit(): events.title = form.title.data events.description = form.description.data events.tags = form.tags.data events.home_img = form.home_img.data db_session.commit() flash('Your Events Has been Updated !', 'success') return redirect(url_for('administration.events', events_id=events.id)) elif request.method == 'GET': form.title.data = events.title form.description.data = events.description form.tags.data = events.tags form.home_img.data = events.home_img return render_template('/administration/addevent.html', form=form, title='Update Event', legend='Update Event')
def updatblog(blogs_id): blogs = Blog.query.get(blogs_id) form = Addpost() if form.validate_on_submit(): blogs.title = form.title.data blogs.img_off = form.img_off.data blogs.body = form.body.data blogs.tags = form.tags.data db_session.commit() flash('Your Post Has been Updated !', 'success') return redirect(url_for('administration.blog', blogs_id=blogs.id)) elif request.method == 'GET': form.title.data = blogs.title form.img_off.data = blogs.img_off form.body.data = blogs.body form.tags.data = blogs.tags return render_template('/administration/addpost.html', form=form, title='Update Post', legend='Update Post')
def addroom(): form = AddRoom() if form.validate_on_submit(): room = Room(title=form.title.data, description=form.description.data, price=form.price.data, mode=form.mode.data, home_img=form.home_img.data, img1_url=form.img1_url.data, img2_url=form.img2_url.data, img3_url=form.img3_url.data) db_session.add(room) db_session.commit() flash('Room Added seccussfly ;) .', 'success') # redirect to the login page return redirect(url_for('administration.addroom')) return render_template('/administration/addroom.html', form=form, title='Add Room', legend='Add Post')
def getroom(room_id): rooms = Room.query.filter_by(id=room_id).one() url_for('rooms.getroom', room_id=rooms) che = GetRoom() if che.validate_on_submit(): pst = Checkout(fullname=che.fullname.data, email=che.email.data, city=che.city.data, state=che.state.data, phone=che.phone.data, zipcode=che.zipcode.data, addr=che.addr.data) #user.set_password(password=form.password.data) # add Client to the database db_session.add(pst) db_session.commit() flash('You are now complete reservation !', 'success') # redirect to the login page return redirect(url_for('rooms.getroom', room_id=rooms)) return render_template('/getroom.html', che=che, rooms=rooms, title='Book This Room')
def delete_event(id): """ Delete a department from the database """ #check_admin() events = Event.query.get(id) db_session.delete(events) db_session.commit() flash('You have successfully delete Event.', "success") # redirect to the departments page return redirect(url_for('administration.events')) return render_template(title="Delete Event")
def delete_reservation(id): """ Delete a department from the database """ #check_admin() checkouts = Checkout.query.get(id) db_session.delete(checkouts) db_session.commit() flash('You have successfully delete Reservation.', "success") # redirect to the departments page return redirect(url_for('administration.reservations')) return render_template(title="Delete Reservation")
def delete_blog(id): """ Delete a department from the database """ #check_admin() blogs = Blog.query.get(id) db_session.delete(blogs) db_session.commit() flash('You have successfully delete Post.', "success") # redirect to the departments page return redirect(url_for('administration.blog')) return render_template(title="Delete Post")
def delete_msg(id): """ Delete a department from the database """ #check_admin() contacts = Contact.query.get(id) db_session.delete(contacts) db_session.commit() flash('You have successfully delete Message.', "success") # redirect to the departments page return redirect(url_for('administration.messages')) return render_template(title="Delete Message")
def delete_room(id): """ Delete a department from the database """ #check_admin() room = Room.query.get(id) db_session.delete(room) db_session.commit() flash('You have successfully delete Room.', "success") # redirect to the departments page return redirect(url_for('administration.rooms')) return render_template(title="Delete Room")
def register(): form = RegistrationForm() if form.validate_on_submit(): #user = User(F_name=form.F_name.data,L_name=form.L_name.data,city=form.city.data,state=form.state.data,zipcode=form.zipcode.data,addr=form.addr.data,password=form.password.data,phone=form.phone.data,email=form.email.data): user = User(email=form.email.data, username=form.username.data, password=form.password.data) #user.set_password(password=form.password.data) # add Client to the database db_session.add(user) db_session.commit() flash('You Are Now Registered Please Log in !', 'success') # redirect to the login page return redirect(url_for('users.login')) return render_template('security/register.html', form=form, title='Sign up')
def addevent(): form = Moreevent() if form.validate_on_submit(): events = Event(title=form.title.data, description=form.description.data, tags=form.tags.data, home_img=form.home_img.data) db_session.add(events) db_session.commit() flash('Event Added seccussfly ;) .', 'success') # redirect to the login page return redirect(url_for('administration.addevent')) return render_template('/administration/addevent.html', form=form, title='Add Event', legend='Add Event')
def addpost(): form = Addpost() if form.validate_on_submit(): blogs = Blog(title=form.title.data, body=form.body.data, img_off=form.img_off.data, tags=form.tags.data) db_session.add(blogs) db_session.commit() flash('Post Added seccussfly ;) .', 'success') # redirect to the login page return redirect(url_for('administration.addpost')) return render_template('/administration/addpost.html', form=form, title='New Post', legend='Add Post')