Populate those empty "activity" and "volume" columns. Show last posts. #315
[zzz-spline-forum.git] / splinext / forum / model / __init__.py
index f312b4d..6dc6bfd 100644 (file)
@@ -14,6 +14,7 @@ class Forum(TableBase):
     __tablename__ = 'forums'
     id = Column(Integer, primary_key=True, autoincrement=True, nullable=False)
     name = Column(Unicode(133), nullable=False)
+    description = Column(Unicode(1024), nullable=False, default=u'', server_default=u'')
     access_level = Column(Enum(u'normal', u'soapbox', u'archive', name='forums_access_level'), nullable=False, default=u'normal', server_default=u'normal')
 
     def can_create_thread(self, user):
@@ -72,6 +73,7 @@ class Post(TableBase):
     position = Column(Integer, nullable=False)
     author_user_id = Column(Integer, ForeignKey('users.id'), nullable=False)
     posted_time = Column(DateTime, nullable=False, index=True, default=datetime.now)
+    raw_content = Column(Unicode(5120), nullable=False)
     content = Column(Unicode(5120), nullable=False)
 
 Index('thread_position', Post.thread_id, Post.position, unique=True)
@@ -82,6 +84,7 @@ Forum.threads = relation(Thread, order_by=Thread.id.desc(), lazy='dynamic', back
 
 Thread.posts = relation(Post, order_by=Post.position.asc(), lazy='dynamic', backref='thread')
 Thread.first_post = relation(Post, primaryjoin=and_(Post.thread_id == Thread.id, Post.position == 1), uselist=False)
+# XXX THIS WILL NEED TO CHANGE when posts can be deleted!  Or change what 'position' means
 Thread.last_post = relation(Post, primaryjoin=and_(Post.thread_id == Thread.id, Post.position == Thread.post_count), uselist=False)
 
 Post.author = relation(users_model.User, backref='posts')