Commits

Brendan Howell committed 045acf6

model tweaks for desc/antecedents

  • Participants
  • Parent commits 77dfd8f

Comments (0)

Files changed (2)

             chunk = sqlsession.query(Chunk).filter(Chunk.id==chunkid).first()
         else:
             #TODO: create new chunk and pass the id 
+            chunk = Chunk("", author, corp, rnd)
+            sqlsession.add(chunk)
+            sqlsession.flush()
             #TODO: set lastchunk to query antecedent
             pass
 
             
         page = Template(file=template)
         page.corpus = corp
+        page.chunkid = chunk.id
         page.lastchunk = lasttext
         #TODO: find next chunk based on descendent
         page.nextchunk = None
     round_id = Column(Integer, ForeignKey('rounds.id'))
     round = relation(Round, backref=backref('chunks', order_by=id))
     antecedent_id = Column(Integer, ForeignKey('chunks.id'))
-    #antecedent = relation("Chunk", remote_side="chunks.id")
+    descendent = relation("Chunk", backref=backref("antecedent", uselist=False, remote_side=[id]))
     
     def __init__(self, text, author, corpus, round):
         self.text = text