I'm trying to access a table and field from controllers.py. The table and field are defined in models.py.
The controller is defined as follows:
from py4web import action, request, abort, redirect, URL
from py4web import DAL
from .common import db, session, T, cache, auth, logger, authenticated, unauthenticated, flash
@action('put')
@action.uses(db)
def put():
color=request.query.get('color') # this works fine
color_id=db(db.colors.code==color).select().first().id
When I put in the correct url in my browser I get the following error message at the console:
'DAL' object has no attribute 'colors'
Any thoughts about what's causing the problem?