[SQLObject] Reference to one of multiple tables
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Timo <tim...@gm...> - 2011-12-28 21:30:34
|
I'm stuck at a part of my program, but I'm not sure if this is the right place to ask. Excuses if it's not. I have a DVD object which can have different statusses, like "on loan", "sold", etc... A dvd can only have 1 status at the time, but I'm confused about how to link it to 1 table only so I can access the correct status with dvd.status . Here's an example: class DVD(SQLObject): status = ???? # Should be sold or onloan data # ... special "dvd" data class Sold(SQLObject): dvd = ForeignKey('DVD') # ... special "sold" data class OnLoan(SQLObject): dvd = ForeignKey('DVD') # ... special "on loan" data Greets, Timo |