Thanks for the reply Bill, but I don't need to know who uploaded the
charts. They are more of a data warehouse. Users subscribe to them and a
reference is created in user_chart.
The bit of my web site I am working on at the moment is where the user
subscribes. I am showing a list of all the Charts available in Charts and
another list of the charts they have subscribed to. Next to each of the
charts in the Full List I will show either "Click here to subscribe" or
"You are already subscribed".
So my is_my_chart function is called for each chart in the Data Warehouse
and shows either a link to subscribe or tells they user they are already
subscribed.
On Wednesday, 7 November 2012 17:03:38 UTC, Bill Thayer wrote:
>
> I noticed that you do not add auth.signature to your table definition.
> Does it not work for you?
>
> If is_my_chart was somthing I needed often like I'd be tempted to change:
> (full discloser: my track record is not good lately)
> db.define_table('chart',
> Field('chartName'),
> Field('id_workbook',db.workbook),
> Field('worksheet'),
> Field('file','upload'),
> auth.signature,
> common_filter = lambda query: db.chart.created_by==auth.user_id,
> format="%(id_workbook)s %(chartName)s",
> )
>
> Then when I needed a different controller function that returned all
> records I could:
>
> db(query, ignore_common_filters=True).select(...) # copied from
> http://www.web2py.com/books/default/chapter/29/06?search=common_filter
>
>
>
> Again I'm not that good at this but it seems logical.
>
> -Bill
>
--