示例#1
0
def delete_req(id):
    """
    Delete the item in the database that matches the specified
    id in the URL
    """
    qry = db_session.query(EnvironmentRequest).filter(
        EnvironmentRequest.id == id)
    req = qry.first()

    if req:
        form = EnvironmentRequestForm(formdata=request.form, obj=req)
        if request.method == 'GET':
            form.keep_data.data = req.keep_data
            form.keep_ld.data = req.keep_ld
            form.backup_db.data = req.backup_db
        if request.method == 'POST' and form.validate():
            # delete the item from the database
            db_session.delete(req)
            db_session.commit()

            flash('Request deleted successfully!')
            return redirect('/')
        return render_template('delete_request.html', form=form)
    else:
        return 'Error deleting #{id}'.format(id=id)
def delete(id):
    qry = db_session.query(Album).filter(Album.id==id)
    album = qry.first()
    if album:
        form = AlbumForm(formdata=request.form, obj=album)
        if request.method == 'DELETE' and form.validate():
            db_session.delete(album)
            db_session.commit()
示例#3
0
def delete():
    courseNum = request.form.get('course')
    assignmentName = request.form.get('assignmentName')
    deleteAssignment = db_session.query(Assignment).filter_by(
        name=assignmentName, class_id=courseNum).first()
    db_session.delete(deleteAssignment)
    db_session.commit()
    return redirect(url_for('search', courseNum=courseNum))
示例#4
0
def del_spe(id):
	qry = db_session.query(Spend).filter(Spend.id==id)
	spend = qry.first()

	db_session.delete(spend)
	db_session.commit()
		
	flash('Spend deleted successfully!')
	return redirect('/spe')
示例#5
0
def del_res(id):
	qry = db_session.query(Reservation).filter(Reservation.id==id)
	reservation = qry.first()

	db_session.delete(reservation)
	db_session.commit()
		
	flash('Reservation deleted successfully!')
	return redirect('/res')
示例#6
0
def holiday_del(del_date):
    print('holiday del')
    qry = db_session.query(Holiday).filter(Holiday.c_acdcode == '0202').filter(
        Holiday.c_date == del_date)
    hday = qry.first()
    db_session.delete(hday)
    db_session.commit()
    print('Holiday delete successfully!')
    return redirect('/holiday')
示例#7
0
def delete(id):

    qry = db_session.query(Article_Info).filter(Article_Info.id == id)
    article_info = qry.first()

    if article_info:
        form = ArticleForm(formdata=request.form, obj=article_info)
        if request.method == 'POST' and form.validate():
            db_session.delete(article_info)
            db_session.commit()
            flash('Article deleted successfully!')
            return redirect('/')
        return render_template('delete_article.html', form=form)
    else:
        return 'Error deleting #{id}'.format(id=id)
示例#8
0
文件: main.py 项目: zcb7/DatabaseGame
def delete(id):

    qry = db_session.query(Userdata).filter(Userdata.user_id == id)
    userdata = qry.first()

    if userdata:
        form = EditForm(formdata=request.form, obj=userdata)
        if request.method == 'POST' and form.validate():
            db_session.delete(userdata)
            db_session.commit()

            flash('User deleted successfully!')
            return redirect('/')
        return render_template('delete_user.html', form=form)
    else:
        return 'Error deleting #{id}'.format(id=id)
示例#9
0
def delete_details(order, form):

    tablet = Tablets()
    id = int(form.orderid.data)
    qry = db_session.query(Orders).filter(Orders.orderId == id)
    order = qry.first()
    if order:
        tid = order.productId
        qry = db_session.query(Tablets).filter(Tablets.tabletId == tid)
        tablet = qry.first()

        tablet.tabletquantity = tablet.tabletquantity + order.quantity
        db_session.delete(order)
        db_session.commit()
        flash('your order is deleted successfully!')

    else:
        flash('orderid does not exsit deleting order is unsuccessfully!')
示例#10
0
def delete(id):
    """
    Delete the item in the database that matches the specified
    id in the URL
    """
    qry = db_session.query(Album).filter(Album.id == id)
    album = qry.first()
    if album:
        form = AlbumForm(formdata=request.form, obj=album)
        if request.method == 'POST' and form.validate():
            # delete the item from the database
            db_session.delete(album)
            db_session.commit()
            flash('Album deleted successfully!')
            return redirect('/')
        return render_template('delete_album.html', form=form)
    else:
        return 'Error deleting #{id}'.format(id=id)
示例#11
0
def delete(id):  #direct deletion form the order details table

    qry = db_session.query(Orders).filter(Orders.orderId == id)
    order = qry.first()
    tid = order.productId
    qry = db_session.query(Tablets).filter(Tablets.tabletId == tid)
    tablet = qry.first()
    if order:

        tablet.tabletquantity = tablet.tabletquantity + order.quantity
        # delete the item from the database
        db_session.delete(order)
        db_session.commit()
        flash('your order is deleted successfully!')
        return redirect('/')

    else:
        return 'Error deleting #{id}'.format(id=order.orderId)
示例#12
0
def delete(id):
    """
    Delete the item in the database that matches the specified
    id in the URL
    """
    qry = db_session.query(Biography).filter(Biography.id == id)
    biography = qry.first()

    if biography:
        form = BiographyForm(formdata=request.form, obj=biography)
        if request.method == 'POST' and form.validate():
            # delete the item from the database
            db_session.delete(biography)
            db_session.commit()

            flash('Book deleted successfully!')
            return redirect('/')
        return render_template('delete_book.html', form=form)
    else:
        return 'Error deleting #{id}'.format(id=id)
示例#13
0
def delete(item_number):
    """
    Delete the item in the database that matches the specified
    id in the URL
    """
    qry = db_session.query(Price).filter(Price.item_number == item_number)
    price = qry.first()

    if price:
        form = PriceForm(formdata=request.form, obj=price)
        if request.method == 'POST' and form.validate():
            # delete the item from the database
            db_session.delete(price)
            db_session.commit()

            flash('Price deleted successfully!')
            return redirect('/')
        return render_template('delete_album.html', form=form)
    else:
        return 'Error deleting #{item_number}'.format(item_number=item_number)
示例#14
0
def delete(id):
    """
    Delete the item in the database that matches the specified
    id in the URL
    """
    qry = db_session.query(Store).filter(
        Store.id==id)
    store = qry.first()

    if store:
        form = StoreForm(formdata=request.form, obj=store)
        if request.method == 'POST' and form.validate():
            # delete the item from the database
            db_session.delete(store)
            db_session.commit()

            flash('Store deleted successfully!')
            return redirect('/')
        return render_template('delete_store.html', form=form)
    else:
        return 'Error deleting #{id}'.format(id=id)
示例#15
0
def delete(id):
    """
    Delete the item in the database
    """
    qry = db_session.query(Bin).filter(Bin.id == id)
    bin = qry.first()
    delete = Delete(qry)
    delete.border = True

    if bin:
        form = ToolForm(formdata=request.form, obj=bin)
        if request.method == 'POST' and form.validate():
            # delete the item from the databse
            db_session.delete(bin)
            db_session.commit()

            flash('Tool listing deleted successfully.')
            return redirect('/')
        return render_template('delete_tool.html', table=delete)
    else:
        return 'Error deleting #{id}'.format(id=id)
示例#16
0
def delete(id):
    """
    Delete the item in the database that matches the specified
    id in the URL
    """
    qry = db_session.query(Song).filter(Song.id == id)
    song = qry.first()

    if song:
        form = SongForm(formdata=request.form, obj=song)
        if request.method == 'POST' and form.validate():
            # delete the item from the database
            db_session.delete(song)
            db_session.commit()

            flash(
                'Song deleted successfully!'
            )  #this is so sick oh my gosh -caroline (p.s. omg i want it where is it from)
            return redirect('/')
        return render_template('delete_album.html',
                               form=form)  #song, not album
    else:
        return 'Error deleting #{id}'.format(id=id)
示例#17
0
文件: main.py 项目: edyadan/fieldwire
def attachmentdelete(id):
    qry = db_session.query(Attachments).filter(Attachments.id == id)
    attachments = qry.first()
    db_session.delete(attachments)
    db_session.commit()
    return redirect('/attachmentlist')
示例#18
0
文件: main.py 项目: edyadan/fieldwire
def floorplandelete(id):
    qry = db_session.query(Floorplans).filter(Floorplans.id == id)
    floorplan = qry.first()
    db_session.delete(floorplan)
    db_session.commit()
    return redirect('/floorplanlist')
示例#19
0
文件: main.py 项目: edyadan/fieldwire
def folderdelete(id):
    qry = db_session.query(Folders).filter(Folders.id == id)
    folders = qry.first()
    db_session.delete(folders)
    db_session.commit()
    return redirect('/folderlist')
示例#20
0
 def delete_permanent(self):
     db_session.delete(self)
     db_session.commit()
示例#21
0
文件: main.py 项目: edyadan/fieldwire
def projectdelete(id):
    qry = db_session.query(Projects).filter(Projects.id == id)
    projects = qry.first()
    db_session.delete(projects)
    db_session.commit()
    return redirect('/projectlist')
示例#22
0
文件: main.py 项目: edyadan/fieldwire
def sheetdelete(id):
    qry = db_session.query(Sheets).filter(Sheets.id == id)
    sheets = qry.first()
    db_session.delete(sheets)
    db_session.commit()
    return redirect('/sheetlist')
示例#23
0
def plano_delete():
    id = request.args.get('id', None)
    qry = db_session.query(plano).filter(plano.id == int(id))
    db_session.delete(qry.first())
    db_session.commit()
    return redirect('/plano_list')