I have a controller *articles.py*.
@auth.requires_login()
def edit():
art_id=request.args(0)
art=db.art_articles[art_id] or redirect(error_page)
form=crud.update(db.art_articles,art,next='view/[id]')
import images
thumbs=images.thumbs()
return dict(form=form, art=art,thumbs=thumbs)
Module *images.py*.
def thumbs():
images = db().select(db.images.ALL, orderby=db.images.title)
output = []
for image in images:
output += LI(A(IMG(_src=URL('download',
args=image.imgfile),_alt=image.title, _width="50px", _height="50px",
_title=image.title), _href=URL("show", args=image.id), _target="_images"))
output = H2('Images') + UL(output)
return output
When requesting* articles/edit/2* I am getting error:
File "applications/Kurt/modules/images.py", line 2, in thumbs
images = db().select(db.images.ALL, orderby=db.images.title)
NameError: global name 'db' is not defined
What is the correct way to do this currently?
--
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.