Hi All,

I have these 3 tables among others

db.define_table('workbook',
Field('path',requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'workbook.path')]),
Field('title',requires=IS_NOT_EMPTY()),
format="%(title)s",
)


db.define_table('chart',
Field('chartName'),
Field('id_workbook',db.workbook),
Field('worksheet'),
Field('file','upload'),
format="%(id_workbook)s %(chartName)s",
)

db.define_table('user_chart',
Field('id_user',db.auth_user,writable=False,readable=False,default=auth.user_id),
Field('id_chart','reference chart'),
Field('title'),
Field('description','text'),
format="%(title)s",
)

I have setup a function in my modal 

def is_my_chart(chartname):
    if db((db.user_chart.id_user == auth.user_id) & 
(db.user_chart.id_chart.chartName == chartname)).count() > 0:
        return True
    else:
        return False

But I get the following error

AttributeError: 'Field' object has no attribute 'chartName'


How do I fetch the fields out of a joined table?

Thanks
Simon

-- 



Reply via email to