Hello I am trying to figure out how to do a query where given the region of
an entry in a database show entries from categories where people have
chosen that region.
I have atm this database code
db.define_table('listing',
Field('userinfo',db.auth_user,default=auth.user_id,
writable=False,readable=False),
Field('main_category', 'list:reference main_category', label="Main
Category", comment='Main Category to Appear in'),
Field('sub_category', 'list:reference sub_category', label="Sub
Category", comment='Sub Category to Appear in'),
Field('region', 'list:reference region', comment='Region to appear in'),
...
then in the view I have
<a href="{{=URL('views', 'region', args=(region.id))}}"
title="{{=region.title}}"><li>{{=region.title}}</li></a>
Then in my controller I have this
def region():
region = request.args(0)
query = (db.listing.region.contains(region)) & (db.listing.confirmed ==
True)
orderby = db.listing.title
pcache = (cache.ram, 15)
paginate = Pagination(db, query, orderby, display_count=10,
cache=pcache, r=request, res=response)
region_query = paginate.get_set(set_links=True)
return dict(region_query = region_query)
What I would like to do is choose the region then the categories and
sub_categories based on the entries that have those values.
If some one can provide some assistance that would be great
*cheers
and thank you
--
---
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/groups/opt_out.