My model includes an optional image upload:
db.define_table('adult',
Field('staff_id', type='integer',
label=T('Staff ID')),
Field('thumbnail', type='upload', label=T('Photo')),
....
In the view I want to display the image if it exists, but hide it if null:
{{=form.custom.begin}}
{{if adult.thumbnail:}}
<div style="float: right;" class="thumbnail">
{{=form.custom.widget.thumbnail}}
</div>
{{pass}}
...
Where the image exists, it displays correctly.
However, where no image has been uploaded the view displays the text
'file'. How do I stop this - I have tried a variety of if statements in the
view but without success.
Any pointers appreciated,
Andy
--
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.