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


Python Crud.read方法代码示例

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


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

示例1: crudeGeral

# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import read [as 别名]
def crudeGeral():

    from gluon.tools import Crud
    crud = Crud(db)

    form = crud.create(db.client)

    id=1

    form2 = crud.read(db.client, id)

    form3 = crud.update(db.client, id)

    form4 = crud.search(db.client)

    #form5 = SQLFORM(db.client, myrecord).process(onsuccess=auth.archive)

    #form5 = crud.update(db.mytable, myrecord, onaccept=auth.archive)

    return dict(form=form,form2=form2,form3=form3,form4=form4)
开发者ID:JulianaTec,项目名称:TesteRepositorio3,代码行数:22,代码来源:NovaManual.py

示例2: crud

# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import read [as 别名]
def crud():

    tablename = request.args(0)
    action = request.args(1)
    event_id  = request.get_vars['eid']
    person_id = request.get_vars['pid']
    record_id = request.get_vars['id']

    if session.crud and session.crud.return_page:
        return_page = URL(session.crud.return_page)
    elif tablename == 'request':
        return_page = URL('requests')
    else:
        return_page = URL('table/' + tablename)

    crud = Crud(shotdb)
    crud.settings.auth = auth   # ensures access control via permissions
    crud.settings.controller = 'staff'
    crud.settings.create_next = return_page
    crud.settings.update_next = return_page
    crud.settings.update_deletable = True
    crud.settings.showid = True

    if session.crud and session.crud.fix_ref_id:
        for ref_table, ref_id in session.crud.fix_ref_id.iteritems():
            if ref_id > 0 and ref_table in shotdb[tablename]:
                    shotdb[tablename][ref_table].default = ref_id
                    shotdb[tablename][ref_table].writable = False

    # add event filter to drop down selectors
    if event_id != None and event_id > 0:
        if tablename == 'help':
            shotdb.help.shift.requires = IS_IN_DB(shotdb(shotdb.shift.event == event_id), 'shift.id', '%(activity)s, %(day)s, %(time)s')
        elif tablename == 'bring':
            shotdb.bring.donation.requires = IS_IN_DB(shotdb(shotdb.donation.event == event_id), 'donation.id', '%(item)s')

    if tablename == 'person':
        crud.settings.create_onvalidation = __create_person_onvalidation
        crud.settings.update_onvalidation = __update_person_onvalidation
        crud.settings.update_onaccept     = __update_person_onaccept
        crud.settings.update_ondelete     = __update_person_ondelete
        shotdb.person.code.writable = False
        shotdb.person.verified.writable = False
        shotdb.person.data_use_agreed.writable = False
        crud.messages.record_created = None
    else:
        # default flash messages
        crud.messages.record_created = None
        crud.messages.record_updated = None
        crud.messages.record_deleted = 'Der Datenbankeintrag wurde gelöscht.'

    if(action == 'add'):
        if person_id:
            shotdb[tablename]['person'].default = person_id
            shotdb[tablename]['person'].writable = False
        crud_response = crud.create(tablename)
    elif(action == 'edit' and record_id != None):
        crud_response = crud.update(tablename, record_id)
    elif(action == 'view' and record_id != None):

        crud.settings.formstyle='divs'

        crud_response = crud.read(tablename, record_id)
    else:
        crud_response = 'Nothing selected!'

    return dict(crud_response = crud_response, action = action, return_page = return_page)
开发者ID:MichaelBechmann,项目名称:shot,代码行数:69,代码来源:staff.py


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