db = DAL(lazy_tables=True) db.define_table('employee', Field('fullname','string',label='Name'), Field('email','string'), Field('phone','string'), Field('kids', 'string'), Field('phone', 'string'), #Field('date','datetime'), Field('dob', 'datetime', label='Date'), Field('department', 'reference department', requires=IS_IN_DB(db, db.department.id, '%(department_name)s')), auth.signature, format='%(fullname)s'
) and now im getting this error AttributeError: 'DAL' object has no attribute 'department' On Sunday, August 14, 2016 at 11:02:56 PM UTC+2, Oasis Agano wrote: > > My code is the following im trying to assign a department to employees and > also create a manager in a department table > > db = DAL(lazy_tables=True) > db.define_table('employee', > Field('fullname','string',label='Name'), > Field('email','string'), > Field('phone','string'), > Field('kids', 'string'), > Field('phone', 'string'), > #Field('date','datetime'), > Field('dob', 'datetime', label='Date'), > Field('department', 'reference department', > requires=IS_IN_DB(db, db.department.id, > '%(department_name)s')), > auth.signature, > format='%(fullname)s' > > ) > db = DAL(lazy_tables=True) > db.define_table('department', > Field('department_name', 'string', label='Department Name'), > # Field('department_name', 'string', label='Department Name'), > Field('manager', 'reference employee', required='true', > requires=IS_IN_DB(db, db.employee.id, '%(fullname)s')), > auth.signature, > format='%(department_name)s' > ) > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.