Re: [SQLObject] Re: Hi guys. Please, I need help
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Scott R. <sc...@to...> - 2004-04-22 10:15:32
|
You need to let SQLobject do the work. :)
class Login(SQLObject):
firstName = StringCol()
middleInitial = StringCol(length=1, default=None)
lastName = StringCol()
class db_request(SQLObject):
new_file = IntCol(default=1)
DbRequest = ForeignKey('Login')
DbSource = ForeignKey('Login')
... snip ...
r1 = db_request.new(new_file=1, DbRequest=p1, DbSource=p2 )
Notice all I did was remove "Id" from the end of your column names.
Fields ending in _id are special items to SQLobject. Besides, you
didn't want to reference the id - you wanted to reference the object.
Let SO worry about the IDs, unless you're doing something especially
tricky.
I also flipped the BoolCol to an IntCol because I've never used it and I
couldn't figure out how to. :) (Is BoolCol a postgres-only column?)
- Scott
|