Hi guys, today I have a new problem. Often times, there are forms in
which one of the fields is an id corresponding to an id in a database
row somewhere, for example:
class Person(SQLObject):
name = StringCol()
phones = MultipleJoin('Phone')
class Phone(SQLObject):
number = IntCol()
person = ForeignKey('Person')
class NewPhoneSchema(formencode.Schema):
number = validators.Int()
personId = IntCol()
in NewPersonSchema, I want personId to automatically check using the
Person model if personId points to a real existing person. It would
probably be very easy to add a custom schema whose to_python method
would do it, but there must be a better way to do it in "general"
right? Because if I had to makes schemas for say 10 forms, it would get
tiring very quickly to do the same exact thing. Plus, the author of
formencode wrote sqlobject as well, so he probably had to do this at
one point.
Any ideas?
Thanks,
Igor
