On 15-jun-04, at 16:52, Cary Fitzhugh wrote:
> Hey all,
>
> I'm using SQLObject 0.5 with SQLite and had a problem with multiple
> joins.
>
> The relevant code is:
>
> class Users(SQLObject):
> _connection = conn
> name = StringCol(default=None)
> email = StringCol(default=None)
> password = StringCol()
> username = StringCol(alternateID=True)
> lastLogin = DateTimeCol(default=None)
> user_type = IntCol(default=None)
> projects = MultipleJoin('Projects')
>
> AND:
>
> class Projects(SQLObject):
> _connection = conn
> state = IntCol()
> number = IntCol(alternateID=True)
> creator = ForeignKey('Users')
> client = ForeignKey('Clients',notNone=True)
>
> As far as I could tell in the documentation to connect these two
> tables, I just say:
> Projects.add(blah blah, creator=Users(1))
>
> and then
> for a in Users(1).projects:
> print a
>
> should give me something, but it just says that there is no users_id
> in the projects table.
>
Add joinColumn="creator_id' in your MultipleJoin definition.
Cheers
Ivo
|