Hello
my db.py
db.define_table('tab1',
Field('f1'),
Field('f2','upload',uploadfolder=os.path.join(request.folder,'uploads'))
)
db.tab1.f2.requires=IS_NOT_EMPTY()
my controller
def tab1():
if request.args(0):
print "editing record"
row=db(db.tab1.id==request.args(0)).select()[0]
db.tab1['f1'].default = row.f1
db.tab1['f2'].default = row.f2
form=SQLFORM.factory(db.tab1,upload=URL('download'))
if form.process().accepted: #update or create
print "updating or creating record"
return dict(form=form)
first i create a record with some text in f1 and a file in f2.
then i edit this record with myapp/default/tab1/*1*
If i submit without changing f1 or f2 field, i get the error about field f2
not having a file to upload.
Can someone help me to understand how to edit a record with sqlform.factory
and upload fields?
*This is just a demo of my problem. *
*In my project i´m using sqlform.factory to edit records from more than one
table.*
Thank you
António
--
---
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/groups/opt_out.