Mayday, mayday,
I have a "bug" in my app.
Sudenly i detect records with no id set
i go to admin to create one record in the "buggy" table and the id is not
set.
All other tables are fine
just in case , my model
db.define_table('trabalhador',
Field('empresa',db.empresa,readable=True,writable=False,label="Empresa",default=getempreiteiroid),
Field('nome','string',label="Nome do Trabalhador",required=True),
Field('foto','upload',autodelete=True,label="Foto"),
Field('bi','string',label="BI",required=True),
Field('ncart','string',label="Número do cartão",default="000"),
Field('ncartval','date',label="Validade do cartão",default=request.now),
Field('apt_medica','upload',autodelete=True,required=False,uploadfolder=os.path.join(request.folder,'uploads'),label='Ficha
de aptidão médica'),
Field('apt_medicaval','date',label='Validade da aptidão médica'),
Field('val_formacao','date',label='Validade da formação'),
Field('rfid','string',default="",label="RFID"),
Field('area','string'),
Field('notify_auditor','boolean',default=False,label="Notificar
auditores"),
Field('notify_responsible','boolean',default=False,label='Notificar
responsável'),
Field('obs','text',label="Obs."),
Field('anual','boolean',default=False,label="anual"),
Field('residente','boolean',default=False,label="Residente"),
format='%(nome)s'
)
# -requires
db.trabalhador.bi.requires=[IS_NOT_EMPTY(error_message="Por favor indique o
BI")]
db.trabalhador.area.requires=IS_EMPTY_OR(IS_IN_SET(areas))
#db.trabalhador.empresa.requires=IS_IN_DB(db, 'auth_user.id
','empresa.empresa',error_message=e_m['not_in_db'])
db.trabalhador.nome.requires=[IS_NOT_EMPTY(error_message="Por favor escreva
o nome completo")]
#if request.function=='trabalhador':
# if (not(request.args)):
# if int(request.vars.id)!=19:
db.trabalhador.apt_medica.requires=[IS_NOT_EMPTY(error_message="Por favor
anexe a aptidão médica")]
db.trabalhador.apt_medicaval.requires=[IS_NOT_EMPTY(error_message="Por
favor indique a validade da aptidão
médica"),IS_DATE(format=T('%Y/%m/%d'),error_message=T("Formato pretendido
aaa/mm/dd"))]
db.trabalhador.rfid.requires=IS_LENGTH(11)
Again i appreciate any help.
Regards
António
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.