本文整理汇总了Python中gluon.tools.Crud.update方法的典型用法代码示例。如果您正苦于以下问题:Python Crud.update方法的具体用法?Python Crud.update怎么用?Python Crud.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gluon.tools.Crud
的用法示例。
在下文中一共展示了Crud.update方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import update [as 别名]
def update():
index = request.args(0)
report = db.reports(index)
if(not report):
redirect(URL('default' , 'index'))
#if(report.created_by != auth.user_id):
#redirect(URL('default' , 'index'))
#Initialize the widget
add_option = SelectOrAdd(form_title="Add new Category",
controller="reports",
function="add_category",
button_text = "Add New")
#assign widget to field
db.reports.category.widget = add_option.widget
from gluon.tools import Crud
crud = Crud(db)
form = crud.update(db.reports, report)
form.add_button('Delete', URL('delete' , args=request.args) )
if form.process().accepted:
report = db.reports(index)
if(not report):
redirect(URL('default' , 'index'))
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
return dict(form=form, report=report)
示例2: admin
# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import update [as 别名]
def admin():
args = request.args
title = 'administration'
if not args:
link = UL(*[LI(A(tab,_href=URL(args=tab))) for tab in db.tables])
return dict(items=link,title=title)
if not args(1):
i = 0
else:
i =1
for tab in db.tables:
if tab==args(i):
tb = db[tab]
crud = Crud(db)
if args(0)=='edit':
form = crud.update(tb, args(2),next=URL(f='admin',args=args(1)))
items = None
title = 'Edit %s ' % args(i)
else:
form = crud.create(tb)
rows = db().select(tb.ALL)
items = SQLTABLE(rows,linkto='edit')
title = 'Insert %s ' % args(i)
return dict(form=form,items=items,title=title)
示例3: update_attendance
# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import update [as 别名]
def update_attendance():
crud = Crud(globals(), db)
db.attendance.patient.default = request.args(0)
db.attendance.patient.writable = db.attendance.patient.readable = False
db.attendance.treatment.default = request.args(1)
db.attendance.treatment.writable = db.attendance.treatment.readable = False
form = crud.update(db.attendance, request.args(0),
labels={
#'patient':'Paciente',
#'treatment':'Tratamento',
'care_date':'Data de atendimento',
'pa_start':'PA Inicial',
'spo2_start':'SPO2 Inicial',
'bpm_start':'BPM Inicial',
'pa_end':'PA Final',
'spo_end':'SPO2 Final',
'bpm_end':'BPM Final',
'patient_owner':'Fisioterapeuta',
'conduct':'Conduta',
'notes':'Observações:'
}
)
return dict(title='Atualizar tratamento', form=form)
示例4: update_person
# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import update [as 别名]
def update_person():
crud = Crud(globals(), db)
form = crud.update(db.person, request.args(0),
labels={'name':'Nome Completo',
'born':'Data de Nascimento',
'address':'Endereço',
'phone':'Telefone',
'mobile':'Celular',
'other_phone':'Telefone (outro)',
'doc_type':'Tipo de Documento',
'doc_id':'Número do documento',
'type_person':'Tipo Cadastro',
'health_care':'Plano de Saúde',
'doctor':'Médico ',
'doctor_doc':'CRM do Médico',
'name_responsable':'[Responsável] Nome',
'born_responsable':'[Responsável] Data Nascimento',
'phone_responsable':'[Responsável] Telefone',
'mobile_responsable':'[Responsável] Celular',
'email_responsable':'[Responsável] E-mail',
'address_responsable':'[Responsável] Endereço',
'doc_type_responsable':'[Responsável] Tipo documento (N/A se no existir responsável)',
'doc_id_responsable':'[Responsável] Número documento',
'notes':'Anotacoes diversas'}
)
return dict(title="Atualizar cadastro", form=form)
示例5: update_treatment
# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import update [as 别名]
def update_treatment():
crud = Crud(globals(), db)
db.treatment.patient.writable = db.treatment.patient.readable = False
form = crud.update(db.treatment, request.args(0),
labels={
#'patient':'Paciente',
'treatment':'Tratamento',
'diagnosis':'Diagnóstico',
'pathologies':'Patologias',
'medications':'Medicamentos',
'start_date':'Data início',
}
)
return dict(title="Atualizar tratamento", form=form)
示例6: update_profile
# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import update [as 别名]
def update_profile():
from gluon.tools import Crud
crud=Crud(db)
x=auth.user.email
table=db(db.Profile_for_others_to_see).select()
for i in table:
if x==i.e_mail:
y=i.id
break
name=auth.user.first_name+" "+auth.user.last_name
db.Profile_for_others_to_see.student_name.default=name
db.Profile_for_others_to_see.student_name.writable=False
update=crud.update(db.Profile_for_others_to_see,y)
return locals()
示例7: zuoye
# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import update [as 别名]
def zuoye():
zuozhe=auth.user_id
keshi_id=request.args[0]
crud=Crud(db)
if db.zuoye((db.zuoye.zuozhe==zuozhe)&(db.zuoye.keshi==keshi_id)):
db.zuoye.defen.writable=False
zuoye_id=db.zuoye((db.zuoye.zuozhe==zuozhe)&(db.zuoye.keshi==keshi_id)).id
form=crud.update(db.zuoye,zuoye_id,deletable=False,next=request.url)
db.zuoye.defen.writable=True
else:
db.zuoye.zuozhe.default=zuozhe
db.zuoye.keshi.default=keshi_id
db.zuoye.defen.writable=False
form=crud.create(db.zuoye,next=request.url)
# db.zuoye.zuozhe.default=None
db.zuoye.keshi.default=None
db.zuoye.defen.writable=True
return dict(form=form)
示例8: crud
# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import update [as 别名]
def crud():
tablename = request.args(0)
action = request.args(1)
record_id = request.get_vars['id']
crud_ = Crud(shotdb)
crud_.settings.controller = 'config'
crud_.settings.create_next = URL('config_event')
crud_.settings.update_next = URL('config_event')
crud_.settings.update_deletable = False
crud_.settings.showid = True
if(action == 'add'):
crud_response = crud_.create(tablename)
elif(action == 'edit' and record_id != None):
crud_response = crud_.update(tablename, record_id)
else:
crud_response = 'Nothing selected!'
return dict(crud_response = crud_response)
示例9: crudeGeral
# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import update [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)
示例10: update
# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import update [as 别名]
def update():
index = request.args(0)
report = db.reports(index)
if(not report):
redirect(URL('default' , 'index'))
#if(report.created_by != auth.user_id):
#redirect(URL('default' , 'index'))
from gluon.tools import Crud
crud = Crud(db)
form = crud.update(db.reports, report)
form.add_button('Delete', URL('delete' , args=request.args) )
if form.process().accepted:
report = db.reports(index)
if(not report):
redirect(URL('default' , 'index'))
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
return dict(form=form, report=report)
示例11: update_test
# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import update [as 别名]
def update_test():
from gluon.tools import Crud
crud = Crud(db)
return dict(form=crud.update(db.balise, request.args(0)))
示例12: editcomment
# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import update [as 别名]
def editcomment():
this_comment = db.comment(request.args(0,cast=int)) or redirect(URL('index'))
from gluon.tools import Crud
crud = Crud(db)
form = crud.update(db.comment, this_comment.id) if auth.user else None
return dict(form=form)
示例13: editpage
# 需要导入模块: from gluon.tools import Crud [as 别名]
# 或者: from gluon.tools.Crud import update [as 别名]
def editpage():
this_page = db.page(request.args(0,cast=int)) or redirect(URL('index'))
from gluon.tools import Crud
crud = Crud(db)
form = crud.update(db.page, this_page.id) if auth.user else None
return dict(form=form)