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


Python tools.Crud类代码示例

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


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

示例1: update_attendance

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)
开发者ID:kairoaraujo,项目名称:PhysioManagement,代码行数:25,代码来源:manager.py

示例2: update

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)
开发者ID:Khaledgarbaya,项目名称:reform_tn_site,代码行数:31,代码来源:reports.py

示例3: create

def create():
	from gluon.tools import Crud

	#Hide the fields that should not be accessable by the user
	hideFields (db.game, ['host_id', 'game_status', 'password'])

	#Run the form
	#form = SQLFORM(db.game)
	#form.add_class('assassins-form')
	#form.vars.host_id=auth.user.id

	#Create the form
	crud = Crud(db)
	crud.messages.submit_button = 'Create Game'
	form = crud.create(db.game)
	form.add_class('assassins-form')
	form.vars.host_id=auth.user.id

	#When the form is submitted, add the creator as a player and go to new game
	if form.process().accepted:
		addPlayer(form.vars.id, auth.user)
		resizeImage(db.game, form.vars.id)
		redirect(URL('game', 'detail', args=form.vars.id))

	return dict(form=form)
开发者ID:bejbej,项目名称:assassins,代码行数:25,代码来源:default.py

示例4: admin

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)
开发者ID:JulianaTec,项目名称:TesteRepositorio3,代码行数:33,代码来源:veiculo.py

示例5: add_log

def add_log():
	import re
	from datetime import datetime
	from gluon.tools import Crud
	pattern = re.compile(r"""
			\[(?P<time>.*?)\]
			\s(?P<mac>[0-9A-F]{2}[:][0-9A-F]{2}[:][0-9A-F]{2}[:][0-9A-F]{2}[:][0-9A-F]{2}[:][0-9A-F]{2})
			\s(?P<more>.*)
			\s*"""
			, re.VERBOSE)
	crud = Crud(db)
	form = crud.create(db.log)
	if form.process(dbio=False).accepted:
		form.vars.log_id = db.log.insert(**dict(form.vars))
		request.vars.log_file.file.seek(0)
		count=0
		for line in request.vars.log_file.file:
			#print 'l', line
			match = pattern.findall(line)	
			if match:
				d = datetime.strptime(match[0][0], '%m/%d/%y %H:%M:%S')
				db.record.insert(log_id=form.vars.log_id, 
						station_id=form.vars.station_id,
						mac=match[0][1], 
						gathered_on=d)			
				count += 1
		session.flash = 'Inserted %s record' % count
		redirect(URL(f='index', vars={'id':form.vars.station_id}))
	return response.render('default/index.html', dict(form=form))
开发者ID:BantouTelecom,项目名称:vtraffic,代码行数:29,代码来源:default.py

示例6: accessory_crud

def accessory_crud():
    """ Create a simple form using the CRUD function of web2py. """

    from gluon.tools import Crud
    crud = Crud(db)
    accessory_crud = crud.create(db.accessory)
    return locals()
开发者ID:JulianaTec,项目名称:TesteRepositorio3,代码行数:7,代码来源:forms.py

示例7: update_person

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)
开发者ID:kairoaraujo,项目名称:PhysioManagement,代码行数:26,代码来源:manager.py

示例8: add_station

def add_station():
	from gluon.tools import Crud
	crud = Crud(db)
	form = crud.create(db.station)
	if form.process(dbio=True).accepted:
		session.flash = 'Station added correctly'
		redirect(URL(f='index'))
	return response.render('default/index.html', dict(form=form))
开发者ID:BantouTelecom,项目名称:vtraffic,代码行数:8,代码来源:default.py

示例9: autocomplet

def autocomplet():

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

    form = crud.create(db.product2, next=URL('autocomplet'),message=T("record created"))
    persons = crud.select(db.product2, fields=['category'],headers={'product2.category': 'Tipo'})

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

示例10: people

def people():

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

    form = crud.create(db.client, next=URL('people'),message=T("record created"))
    persons = crud.select(db.client, fields=['name'],headers={'client.name': 'Name'})

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

示例11: index

def index():
    """
    example action using the internationalization operator T and flash
    rendered by views/default/index.html or views/generic.html
    """
    from gluon.tools import Crud

    crud = Crud(db)

    form = crud.create(db.userskill)
    return dict(form=form)
开发者ID:csschwarz,项目名称:pyJigsawSkills,代码行数:11,代码来源:default.py

示例12: update_profile

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()
开发者ID:varshit97,项目名称:placement-website,代码行数:14,代码来源:default.py

示例13: update_treatment

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)
开发者ID:kairoaraujo,项目名称:PhysioManagement,代码行数:14,代码来源:manager.py

示例14: zuoye

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)
开发者ID:chugle,项目名称:myapp,代码行数:18,代码来源:default.py

示例15: crudeGeral

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,代码行数:20,代码来源:NovaManual.py


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