X-Git-Url: http://git.veekun.com/zzz-spline-forum.git/blobdiff_plain/be07212348141269cd4c5f1544b9a920a6abbfff..53a1b80b0d77912434513cd878f71c2520fbc0a4:/splinext/forum/model/__init__.py diff --git a/splinext/forum/model/__init__.py b/splinext/forum/model/__init__.py index 80ca57e..6dc6bfd 100644 --- a/splinext/forum/model/__init__.py +++ b/splinext/forum/model/__init__.py @@ -84,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')