本文整理汇总了Python中gluon.sqlhtml.SQLFORM.process方法的典型用法代码示例。如果您正苦于以下问题:Python SQLFORM.process方法的具体用法?Python SQLFORM.process怎么用?Python SQLFORM.process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gluon.sqlhtml.SQLFORM
的用法示例。
在下文中一共展示了SQLFORM.process方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_qc
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def add_qc():
if 'flash' in request.vars:
response.flash= request.vars['flash']
form = SQLFORM(db.episode, fields=['name', 'file', 'video_link', 'is_h', 'is_public', 'allow_qcteam'])
if form.process().accepted:
try:
subs = ssa_parser.importSubsFromSSA(request.vars.file.value)
except Exception, e:
response.flash = "Errors importing the subs (%s)" % e.message
db(db.episode.id == form.vars.id).delete()
else:
try:
subsNb=0
for s in subs:
if 'Text' in s and len(s['Text'])>0:
actor= None
if 'Actor' in s:
actor= s['Actor']
db.sub.insert(episode=form.vars.id
,start_time= s['Start']
,end_time= s['End']
,style= s['Style']
,text= s['Text']
,actor= actor)
subsNb+=1
db(db.episode.id == form.vars.id).update(subs_nb=subsNb)
except Exception, e:
response.flash= "Errors inserting the subs in the database (%s)" % e.message
else:
示例2: zznew
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def zznew():
'''
patient registration form creation - ??use custom sql form??
'''
print '>>> process ptreg form <<<'
#form = SQLFORM(db.patient)
labels ={'lname':'Last Name', 'mrn': 'MRN'}
form = SQLFORM(db.patient,
0,
fields=['mrn','lname', 'ethnicity', 'date_of_birth'],
labels = labels,
#formstyle="divs",
showid=False,
submit_button='Add New')
#if form.process(session=None, formname='patient_reg').accepted:
if form.process(session=None, formname=None).accepted:
response.flash = 'form accepted'
# redirect after entry
redirect(URL('status'))
elif form.errors:
response.flash = ' form has errors'
else:
response.flash = 'please enter form data'
return dict(form = form)
示例3: contact
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def contact():
from models.contact import Contact
db = application.db(models=[Contact])
form = SQLFORM(db.Contact, _action=URL('experiments', 'default', 'contact'))
if form.process(session=application.session).accepted:
redirect(URL())
return {'form': form}
示例4: update_project
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def update_project():
response.view = 'company/details_project.html'
projectid = request.args(1, cast = int)
form = SQLFORM(db.co_project, projectid, showid = False)
if form.process().accepted:
response.flash = 'Project updated'
elif form.errors:
response.flash = 'Errors occurs!'
return locals()
示例5: create_project
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def create_project():
response.view = 'company/details_project.html'
form = SQLFORM(db.co_project)
if form.process().accepted:
session.flash = 'Project created'
redirect(URL('list_project'))
elif form.errors:
response.flash = 'Errors occurs!'
return locals()
示例6: update_task
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def update_task():
response.view = 'company/details_task.html'
taskid = request.args(1, cast = int)
projectid = db(db.co_task.id == taskid).select(db.co_task.project).first().project
projectname = db.co_project(projectid).name
form = SQLFORM(db.co_task, taskid, showid = False)
if form.process().accepted:
response.flash = 'Task updated'
elif form.errors:
response.flash = 'Errors occurs!'
return locals()
示例7: checkForm
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def checkForm(self, table):
formnamemodal = "formmodal_%s" % self.key
form = SQLFORM(table, formname=formnamemodal, _class="form-horizontal", formstyle='bootstrap-modal', fields=self.fields, kwargs=self.kwargs)
if self.script:
form.append(SCRIPT(self.script))
if form.process().accepted:
command = "jQuery('#%s').modal('hide');" % (self.modal_id)
command += self.cmd
self.response.flash = self.flash
self.response.js = command
elif form.errors:
self.response.flash = self.errormsg
return form
示例8: view_task
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def view_task():
taskid = request.args(1, cast = int)
projectid = db(db.co_task.id == taskid).select(db.co_task.project).first().project
task = SQLFORM(db.co_task, taskid, showid = False, readonly = True)
posts = db(db.co_taskpost.task == taskid).select(orderby = db.co_taskpost.created_on)
db.co_taskpost.task.default = taskid
post = SQLFORM(db.co_taskpost)
if post.process().accepted:
session.flash = 'Post added'
redirect(URL('view_task', args = ('view', taskid)))
elif post.errors:
response.flash = 'Errors occurs!'
return locals()
示例9: do_form_update
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def do_form_update(self, record_id):
response = current.response
T = current.T
table = self.table
action = 'update'
self.nav = self.navegate(action)
record = None
if isinstance(record_id, str):
record_id = int(record_id)
record = table[ record_id ]
if not record: raise HTTP(404, 'Record ID invalid!')
if isinstance(table._format,str):
record_label = table._format % record
else:
record_label = table._format(record)
response.title = T(table._plural)
response.subtitle = T('Editing')+': '+record_label
response.breadcrumbs = record_label
buttons = self.get_form_buttons(action, record_id)
attr = dict(
onsuccess=self.customize.on_form_success)
hidden = self.get_hidden_fields(action, record.id)
if hidden.get('_next'):
attr['next'] = hidden['_next']
self.customize.on_before_init(self, action)
form = SQLFORM(
table,
record=record,
buttons=buttons,
deletable=False,
formstyle=formstyle_onx,
fields=self.customize.on_fields_list(self, action),
hidden=hidden
)
if self.save_and_add_enabled:
form[0].append(self.js_submit_and_add())
self.customize.on_after_init(self, form, action)
if form.process(**attr).accepted:
response.flash = T('Record Updated')
elif form.errors:
response.flash = form.errors
return dict(content=form)
示例10: create_task
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def create_task():
response.view = 'company/details_task.html'
projectid = request.args(1, cast = int)
projectname = db.co_project(projectid).name
db.co_task.project.default = projectid
form = SQLFORM(db.co_task)
if form.process().accepted:
session.flash = 'Task created'
redirect(URL('list_task', args = (projectid)))
elif form.errors:
response.flash = 'Errors occurs!'
return locals()
示例11: create_employee
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def create_employee():
response.view = 'company/details_employee.html'
form = SQLFORM(db.co_employee)
if form.process().accepted:
newuserid = db.auth_user.insert(first_name = form.vars.firstname, last_name = form.vars.lastname, email = form.vars.email, password = db.auth_user.password.validate('Pa$$w0rd')[0])
employee = db(db.co_employee.id == form.vars.id).select().first()
employee.update_record(authuser = newuserid)
session.flash = 'Employee created'
redirect(URL('list_employee'))
elif form.errors:
response.flash = 'Errors occurs!'
return locals()
示例12: update_vacation
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def update_vacation():
response.view = 'company/details_vacation.html'
vacationid = request.args(1, cast = int)
db.co_vacation.status.writable = False
db.co_vacation.employee.readable = False
db.co_vacation.employee.writable = False
form = SQLFORM(db.co_vacation, vacationid, showid = False)
if form.process().accepted:
response.flash = 'Employee updated'
elif form.errors:
response.flash = 'Errors occurs!'
return locals()
示例13: create_vacation
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def create_vacation():
response.view = 'company/details_vacation.html'
db.co_vacation.employee.default = db(db.co_employee.authuser == auth.user.id).select().first().id
db.co_vacation.status.writable = False
db.co_vacation.employee.readable = False
db.co_vacation.employee.writable = False
form = SQLFORM(db.co_vacation)
if form.process().accepted:
session.flash = 'Vacation application created'
redirect(URL('list_vacation'))
elif form.errors:
response.flash = 'Errors occurs!'
return locals()
示例14: membership
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def membership():
if "new" in request.args:
form = SQLFORM(db.auth_membership)
else:
form = SQLFORM(db.auth_membership, db.auth_membership(request.args(1)))
if "view" in request.args:
form.custom.widget.user_id["_disabled"] = "disabled"
form.custom.widget.group_id["_disabled"] = "disabled"
if form.process().accepted:
session.flash = "Group updated!"
redirect(URL("memberships"))
elif form.errors:
response.flash = "Errors occurs!"
return locals()
示例15: update_employee
# 需要导入模块: from gluon.sqlhtml import SQLFORM [as 别名]
# 或者: from gluon.sqlhtml.SQLFORM import process [as 别名]
def update_employee():
response.view = 'company/details_employee.html'
employeeid = request.args(1, cast = int)
form = SQLFORM(db.co_employee, employeeid, showid = False)
if form.process().accepted:
authuser = db(db.co_employee.id == employeeid).select().first()
if authuser.authuser:
user = db(db.auth_user.id == authuser.authuser).select().first()
user.update_record(first_name = form.vars.firstname, last_name = form.vars.lastname, email = form.vars.email)
session.flash = 'Employee updated'
redirect(URL('list_employee'))
elif form.errors:
response.flash = 'Errors occurs!'
return locals()