I have 2 SQLFORM.grids, they are:

##MODELS
db.define_table('company', #each staff can only see the customers under 
their account
    Field('company_name', 'string',length=255,requires=IS_NOT_EMPTY()),
    Field('description','text'),
    format='%(company_name)s'
)

db.define_table('employees', #each customer has their key contacts
    Field('company_id','reference company',writable=False,label='Company 
Name'), 
    Field('first_name', 'string',length=255,requires=IS_NOT_EMPTY()),
    Field('last_name', 'string',length=255,requires=IS_NOT_EMPTY()),
    Field('role', 'string',length=255,requires=IS_NOT_EMPTY()),
)

##CONTROLLER
def company():
    grid=SQLFORM.grid(db.company.created_by==auth.user_id,links = [lambda 
row: A('Add Employee',,_href=URL("default","employees",args='new')))
    return locals()

def employees():
    grid=SQLFORM.grid(db.employees.created_by==auth.user_id,links = [lambda 
row: A('View Company Details',_href=URL("default","company",args=row.
company_id)))
    return locals()

The problem I have is, When I click on the LINK (either the *Add Employee*or 
the 
*View Company Details* links), I am told "Not Authorized".
I assume it has to do with user_signature.

How can I use SQLFORM.grid with user-defined links and still keep 
user_signature=True?

If I am using it wrongly or misinterpret its correct use, please correct me.

Thank you!

-- 



Reply via email to