Howdy. I have a task with web2py. This is my first experience. My
background is in Flask/Django. Here are a few quick questions:
1. I have an image in the a database. The model is defined like this:
Field('Image', "upload", requires=[
IS_NOT_EMPTY()], autodelete=True, uploadfolder='uploads/', notnull=False,
label=T('Images'),
represent=lambda x, row: x and A('%s' % (db.package.Images.retrieve(x)[0]),
_href=URL(
'default', 'template/viewer.html', args=x),
_target="_blank",
_title=T("Open Image"),
_class='file-reference')
or ''),
Can someone explain what this does conceptually?
db.package.Images.retrieve(x)[0]
If I understand, this will look in the package table, in the Image field,
and it will retrieve the image that matches x (which is the value of x in
this table). What I'm not sure, is it matches x and pulls the first
element. I'm probably going to wipe this code and not use it (it doesn't
work) but I'm curious what it was attempting to do.
2. How can I display the image and have it clickable (I have it to show the
text currently). I see the images get uploaded to 'uploads/'. I'm having
trouble finding exactly how retrieve() works in the docs, perhaps I've been
looking in the wrong place.
3. I want to build a basic CRUD admin interface to manage a table defined
in the model. Any two cents on where I can start here? I've gone through
some of the docs.
4. How do I add a user to a membership 'admin' ?
--
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.