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


Python gluon.IS_NOT_EMPTY属性代码示例

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


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

示例1: _

# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import IS_NOT_EMPTY [as 别名]
def _():
    tbl = db.define_table(
        'plugin_comment_comment',
        Field('body', 'text', label=T('Your comment')),
        Field('item_id', 'string', length=64),
        auth.signature,
    )
    tbl.item_id.readable = False
    tbl.item_id.writable = False
    tbl.body.requires = IS_NOT_EMPTY()

    return lambda item_id: LOAD(
        'plugin_comment', 'index.load', args=[item_id], ajax=True) 
开发者ID:ybenitezf,项目名称:nstock,代码行数:15,代码来源:plugin_comment.py

示例2: _

# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import IS_NOT_EMPTY [as 别名]
def _():
    plugins = PluginManager('text', app=None)
    if plugins.text.app is not None:
        # this will register the content/type on the application
        plugins.text.app.registerContentType('text', ContentText())
        if not hasattr(db, 'plugin_text_text'):
            # configure ckeditor
            editor = CKEditor(db=db)
            # definimos la BD
            tbl = db.define_table(
                'plugin_text_text',
                Field('byline', 'string', length=250, default=''),
                Field('body', 'text', label=T('Content'), default=''),
                Field('item_id', 'string', length=64),
                auth.signature,
            )
            tbl.byline.label = T('By line')
            tbl.item_id.readable = False
            tbl.item_id.writable = False
            tbl.body.requires = IS_NOT_EMPTY()
            tbl.body.widget = editor.widget

            # enable record  versioning
            tbl._enable_record_versioning()

    return 
开发者ID:ybenitezf,项目名称:nstock,代码行数:28,代码来源:plugin_text.py

示例3: edit

# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import IS_NOT_EMPTY [as 别名]
def edit():
    org = db.organization(request.args(0))
    tbl = db.organization
    tbl.users.readable = False
    tbl.users.writable = False
    tbl.desks.readable = False
    tbl.desks.writable = False
    tbl.name.requires = [IS_NOT_EMPTY()]

    # edit form
    form = SQLFORM(db.organization, record=org, showid=False)
    if form.process().accepted:
        redirect(URL('view', args=[org.id]))

    return locals() 
开发者ID:ybenitezf,项目名称:nstock,代码行数:17,代码来源:org.py

示例4: create

# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import IS_NOT_EMPTY [as 别名]
def create():
    """Create a new organization"""
    tbl = db.organization
    tbl.users.readable = False
    tbl.users.writable = False
    tbl.desks.readable = False
    tbl.desks.writable = False
    tbl.name.requires = [
        IS_NOT_EMPTY(
            error_message=T("Cannot be empty")
        ),
        IS_NOT_IN_DB(
            db,
            'organization.name',
            error_message=T(
                "An Organization witch that name is allready in nStock"))]

    form = SQLFORM(tbl)
    form.add_button(T('Cancel'), URL('index'))

    if form.process().accepted:
        # add the new organization
        g_id = auth.user_group(auth.user.id)
        # give the user all perms over this org
        auth.add_permission(g_id, 'update', tbl, form.vars.id)
        auth.add_permission(g_id, 'read', tbl, form.vars.id)
        auth.add_permission(g_id, 'delete', tbl, form.vars.id)
        redirect(URL('index'))

    return locals() 
开发者ID:ybenitezf,项目名称:nstock,代码行数:32,代码来源:org.py

示例5: create

# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import IS_NOT_EMPTY [as 别名]
def create():
    org = db.organization(session.org_id)
    tbl = db.desk
    tbl.item_list.readable = False
    tbl.item_list.writable = False
    tbl.name.requires = IS_NOT_EMPTY()

    form = SQLFORM(db.desk)
    form.add_button(T('Cancel'), URL('org', 'view', args=[org.id]))

    if form.process().accepted:
        # add the new desk to the org list
        desk_id = form.vars.id
        # add current users as the one with permission to update manage
        # this desk
        auth.add_permission(
            auth.user_group(auth.user.id),
            'update',
            db.desk,
            desk_id)
        desk_list = org.desks
        desk_list.insert(0, desk_id)
        org.update_record(desks=desk_list)
        # return to the org desk list
        redirect(URL('org', 'view', args=[org.id]))

    return locals() 
开发者ID:ybenitezf,项目名称:nstock,代码行数:29,代码来源:desk.py


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