Hi folks,

I'm trying to add some query logic to my fledgling app (with SO), but
having a bit of trouble with select and foreign keys. The story with
reduced complexity model:

class Shot(SQLObject):
    shot_name = UnicodeCol(length=16)
    lead_td = ForeignKey('User')
    lead_comp = ForeignKey('User')
    start_frame = IntCol(default=1)

class Project(SQLObject):
    project_name = UnicodeCol(length=16, alternateID=True,
                           alternateMethodName="by_project_name")
    display_name = UnicodeCol(length=55)
    shots = MultipleJoin('Shot')

    def usersShots(self, user):
        shot_list = Shot.select(Shot.q.lead_td == user)
        return shot_list


When I make the call to usersShots() I get:

"AttributeError: Shot instance has no attribute 'lead_ld'"


To test things I try to modify that function to not use a foreign key:

    def usersShots(self, user):
         shot_list = Shot.select(Shot.q.start_frame == 101)
         return shot_list

And it works fine.

Is my problem to do with it being a foreign key, or perhaps it's to do
with the _ in the "lead_td" as seems suggested by my researching the
problem. If it is the _ problem, is there a fix that doesn't involve
me changing all my code?This wont be the only attribute named like
that!  I tried dbname="leadtd" in the declaration but didn't find any
joy.

Thanks in advance for any help.

Cheers,
Rangi.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to