当前位置: 首页>>代码示例>>Python>>正文


Python DBSession.delete方法代码示例

本文整理汇总了Python中nextgisbio.models.DBSession.delete方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.delete方法的具体用法?Python DBSession.delete怎么用?Python DBSession.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nextgisbio.models.DBSession的用法示例。


在下文中一共展示了DBSession.delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: delete_anlist

# 需要导入模块: from nextgisbio.models import DBSession [as 别名]
# 或者: from nextgisbio.models.DBSession import delete [as 别名]
def delete_anlist(request):
    annotation_id = request.matchdict['id']
    success = True
    try:
        with transaction.manager:
            dbsession = DBSession()
            annotation = dbsession.query(Annotation).filter_by(id=annotation_id).one()
            dbsession.delete(annotation)
    except:
        success = False
    return {'success': success}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例2: delete_card

# 需要导入模块: from nextgisbio.models import DBSession [as 别名]
# 或者: from nextgisbio.models.DBSession import delete [as 别名]
def delete_card(request):
    card_id = request.matchdict['id']
    success = True
    try:
        with transaction.manager:
            dbsession = DBSession()
            card = dbsession.query(Cards).filter_by(id=card_id).one()
            dbsession.delete(card)
    except:
        success = False
    return {'success': success}
开发者ID:nextgis,项目名称:nextgisbio,代码行数:13,代码来源:cards.py

示例3: table_delete_jtable

# 需要导入模块: from nextgisbio.models import DBSession [as 别名]
# 或者: from nextgisbio.models.DBSession import delete [as 别名]
def table_delete_jtable(request):
    session = DBSession()

    if ('person_id' in request.POST) and request.POST['person_id'].isdigit():
        person_id = int(request.POST['person_id'])
        person = session.query(Person).options(joinedload('user')).get(person_id)
    else:
        raise Exception('Deleting item: id is not applied')

    session.delete(person)
    session.delete(person.user)
    transaction.commit()
    session.close()

    return {
        'Result': 'OK'
    }
开发者ID:nextgis,项目名称:nextgisbio,代码行数:19,代码来源:views_jtable.py

示例4: remove_image

# 需要导入模块: from nextgisbio.models import DBSession [as 别名]
# 或者: from nextgisbio.models.DBSession import delete [as 别名]
def remove_image(request):
    image_id = request.matchdict['image_id']
    obj_type = request.matchdict['type']

    with transaction.manager:
        dbSession = DBSession()
        dbSession.query(CardsImages).filter_by(image_id=image_id).delete()
        image = dbSession.query(Images).filter_by(id=image_id).one()
        if image.local and os.path.exists(image.local):
            os.remove(image.local)
            path_without_ext, extension = os.path.splitext(image.local)[0], os.path.splitext(image.local)[1]
            for key_size in THUMBNAIL_SIZES:
                os.remove('%s_%s%s' % (path_without_ext, key_size, extension))

        dbSession.delete(image)

    return {'success': True}
开发者ID:nextgis,项目名称:nextgisbio,代码行数:19,代码来源:images.py

示例5: table_delete_jtable

# 需要导入模块: from nextgisbio.models import DBSession [as 别名]
# 或者: from nextgisbio.models.DBSession import delete [as 别名]
def table_delete_jtable(request):
    session = DBSession()
    table, table_name = helpers.get_table_by_name(request)

    if ('id' in request.POST) and request.POST['id'].isdigit():
        item_id = int(request.POST['id'])
        item = session.query(table).get(item_id)
    else:
        raise Exception('Deleting item: id is not applied')

    session.delete(item)
    transaction.commit()
    session.close()

    return {
        'Result': 'OK'
    }
开发者ID:nextgis,项目名称:nextgisbio,代码行数:19,代码来源:__init__.py


注:本文中的nextgisbio.models.DBSession.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。