{{product=db().select(db.product.ALL, orderby='<random>')[0]}}
and change your variable names within the view accordingly.
Francisco
On Saturday, 14 June 2014 17:08:51 UTC+1, Ajeigbe Yekeen wrote:
>
>
> Hello,
>
> I would like to build a page with images (and data) that constantly cycles
> through the corresponding information in the database. The idea is an
> homepage with a continually changing face for each user(or reload).
>
> I have this in my model:
> db.define_table(
> 'product',
> Field('name', required=True),
> Field('category',),
> Field('description_short', 'text'),
> Field('description_long', 'text'),
> Field('price', 'integer'),
> Field('private_info', 'text'),
> Field('quantity', 'double'),
> Field('on_sale', 'boolean'),
> Field('in_stock','integer'),
> Field('image', 'upload', uploadfield='image_file'),
> Field('image_file', 'blob'),
> format='%(name)s')
>
> The basic html for the view is:
> <div class="tile">
> <img src="{{=URL('download', args=image[0].file)}}" alt="Image of {{=T(
> db.product.name)}}"/>
> <div>
> <h3>{{=T(db.product.name)}}</h3>
> <p>{{=T(db.product.description_short)}}</p>
> </div>
> <span>N{{=T(db.product.price)}}</span>
> </div>
>
> There would be about 20 instances of this "tile" on a single page. How do
> make each unique & different on load for each user?
>
> Thank you.
>
--
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.