just a suggestion, why not start your code from simple, like the python 
philosophy 'simple is better than complex, complex is better than 
complicated'?
after start your code from simple than add the DAL field constructor one by 
one.
e.g. 
*step 1 : for starting i comment the on_define (for dal field constructor), 
test is the table is work as expected or not*
# on_define_department
def on_define_department(table): 
# label
table.department.label = T('Department')
# notnull
table.department.notnull = True
# required
table.department.required = True
# requires
table.department.requires = IS_NOT_IN_DB(db, table.department)
# unique
table.department.unique = True

# create table : department
db.define_table('department', 
Field('department'), 
# on_define = on_define_department, 
format = '%(department)s')

*step 2 : test the dal field constructor label, after it works, release the 
commented dal field constructor one by one*
# on_define_department
def on_define_department(table): 
# label
table.department.label = T('Department')
# notnull
# table.department.notnull = True
# required
# table.department.required = True
# requires
# table.department.requires = IS_NOT_IN_DB(db, table.department)
# unique
# table.department.unique = True

# create table : department
db.define_table('department', 
Field('department'), 
on_define = on_define_department, 
format = '%(department)s')

best regards,
stifan

-- 
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/groups/opt_out.

Reply via email to