So I am writing my own wiki.  Here are my relevant tables:

class WikiPage(SQLObject):
    name = StringCol(alternateID=True, length=40)
    currentVersion = IntCol(default=None)
    lockedTime = DateTimeCol(default=None)
    lockedPerson = IntCol(default=None)
class WikiData(SQLObject):
    wikiPage = ForeignKey('WikiPage')
    version = IntCol(default=None)
    time =
    author = ForeignKey('User')  
    ipnr = StringCol(default=None) # the ip number of committer
    comment = StringCol(default=None)
    text = StringCol() # the actual text of the page

Now, when I do a simple select like:

x = ( WikiData.q.wiki_page_id == 1 ) [:1]

I get:
AttributeError: WikiData instance has no attribute 'wiki_page_id'

When I try replacing wiki_page_id with wiki_page or wikiPage, it still doesn't work.

But when I use version, it works fine.

How can I make it work? (This is just the first step to a more complicated query.)