Massimo,

I added two lookup table to my application:

db=SQLDB('sqlite://annet.db')

db.define_table('shape',
  SQLField('name'),
  migrate='shape.table')

db.define_table('color',
  SQLField('name'),
  migrate='color.table')

db.define_table('shapecolor',
  SQLField('shapename'),
  SQLField('colorname'),
  migrate='shapecolor.table')

db.shapecolor.shapename.requires=IS_IN_DB(db,db.shape.name,'%(name)s')
db.shapecolor.colorname.requires=IS_IN_DB(db,db.color.name,'%(name)s')

db.shapecolor.colorname.requires=IS_NOT_IN_DB(db
(db.shapecolor.shapename==request.vars.shapename),'shapecolor.colorname')


Doing so raised the following problem: when I comment out the last
validator, I have two drop boxes in the admin from which I can choose
a shape and a color and insert them into the database. However, when I
uncomment the two column unique constraint, the color drop box breaks,
it becomes a text field. When I insert a shape and color combination
that's already in the database I get an error, so the constraint
works, but loosing the drop box functionality on color is rather
awkward.

Best regards,

Annet.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to