本文整理匯總了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)
示例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
示例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()
示例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()
示例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()