'm working with SQLObject and I'm getting frustated because of lack of
examples. First of all, I'm having problems creating tables with
many-many relationships
by means of RelatedJoin. I want to create and know how work the CRUD
operations in the tables created by RelatedJoin operation. I have two tables
I've created as follow:
class Term(SQLObject):
name = StringCol(default=None)
description = StringCol(default=None)
vocabulary = ForeignKey('Vocabulary')
term_questions = RelatedJoin('Question', joinColumn='question',
otherColumn='term',
intermediateTable='Term_questions')
Term.createTable(ifNotExists=True)
class Question(SQLObject):
question_file = StringCol(default=None, length=255, unique=True)
question_name = StringCol(default=None)
question_type = StringCol(default=None)
term_questions = RelatedJoin('Term', joinColumn='term',
otherColumn='question',
intermediateTable='Term_questions')
Question.createTable(ifNotExists=True)
So, I have a new table with two columns (term and question). How CRUD
operations work?
I've tried to create a new instance of Term_questions table:
Term_questions(term=term.id, question=q.id), but the module Term_questions
doesn't exist or if I try:
q = Question(question_file="file", question_name= "name",
question_type="MultipleChoice")
term.term_questions = q.id
I get: AttributeError: can't set attribute
Can anybody help me?
Thanks in advance.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss