Model:
db.define_table('product',
Field('title', 'string', length=64),
Field('image', 'upload'),
)
Controller:
def edit_product_0():
form = SQLFORM(db.product, _id='product_table')
if form.accepts(request.vars, session, keepvalues=True,
dbio=False):
form.vars.id = db.product.insert(**dict(form.vars))
return dict(form=form)
The form displays, I enter a title and use the image field to select a
local jpeg.
Submit generates error:
Traceback (most recent call last):
File "gluon/restricted.py", line 173, in restricted
File "E:/web2py/applications/mug/controllers/admin.py", line 381, in
<module>
File "E:/web2py/applications/mug/models/db.py", line 139, in filter
File "gluon/tools.py", line 1664, in f
File "E:/web2py/applications/mug/controllers/admin.py", line 262, in
edit_product_0
File "gluon/sql.py", line 1842, in insert
File "gluon/sql.py", line 1817, in _insert
SyntaxError: invalid field names: ['image_newfilename']
I can fix this by adding a field 'image_newfilename' to the model, but
is this the
intended behavior? Can I change the name to something shorter to
improve
the appearance of the form?
Karl
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.