當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。