I've never tried using a ForeignKey as an alternateID too. There is
probably a more elegant way, but in this case I usually just use a select.
If you want to select a given question based on the component, you can do
qs = Question.select(Question.q.componentID==c.id)
q = qs
----- Original Message -----
From: "Ksenia Marasanova" <ksenia@...>
To: "SQLObject discussion" <sqlobject-discuss@...>
Sent: Thursday, October 28, 2004 6:47 PM
Subject: [SQLObject] by<Columnname> method for ForeignKey column
> Hi all,
> I have a table with unique ForeignKey, because it has one-to-one
> relationship with another table:
> class Question(SQLObject):
> question = StringCol()
> component = ForeignKey('Component', alternateID=True, cascade=True)
> But Question.byComponent() doesn't work:
> AttributeError: type object 'Question' has no attribute 'byComponent'
> Shouldn't it be used that way? Sorry if I am missing something, it's
> kind of late and this is my first application with SQLObject.
> BTW, it's an amaizingly cool component that saves a lot of boring work
> :) Many thanks to Ian Bicking for creating it.
> This Newsletter Sponsored by: Macrovision
> For reliable Linux application installations, use the industry's leading
> setup authoring tool, InstallShield X. Learn more and evaluate
> today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/
> sqlobject-discuss mailing list