I've been able to develop a very simple test-case that highlights my
problem. The error is <type 'exceptions.KeyError'> 'group':
The idea is groups have events, events can only be created by owner of
a group, and owner of a group has to be an authenticated user.
[[Models]]
db.define_table(
'event',
Field('name', requires=IS_NOT_EMPTY()),
Field('description'),
Field('image', requires=IS_IMAGE()), # might expand this to a list
Field('datetime', requires=[IS_NOT_EMPTY(), IS_DATETIME()]),
Field('location'),
Field('group_id', db.group, requires=IS_NOT_EMPTY()),
format='%(name)s'
)
db.define_table(
'group',
Field('name', requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db, 'group.name')]),
Field('description'),
Field('image', requires=IS_IMAGE()), # will expand this to a list
Field('date_created', requires=[IS_NOT_EMPTY(), IS_DATETIME()]), #
want timestamp actually
Field('tags'),
Field('website', requires=IS_HTTP_URL()),
Field('facebook', requires=IS_HTTP_URL()), # want to force user to
input a facebook.com URL
Field('owner', [IS_NOT_EMPTY(), auth.user]),
format='%(name)s'
)
[[Controller]]
def events():
eventlist = SQLTABLE(db().select(db.event.name, db.event.description))
return dict(eventlist=eventlist)
What am I doing wrong?
Thanks for all information,
Alec Taylor