Make Post.author an innerjoin. veekun-promotions/2010101501 veekun-promotions/2010101701
authorEevee <git@veekun.com>
Sun, 26 Sep 2010 04:52:46 +0000 (21:52 -0700)
committerEevee <git@veekun.com>
Sun, 26 Sep 2010 04:52:46 +0000 (21:52 -0700)
splinext/forum/model/__init__.py

index c913561..b8f9225 100644 (file)
@@ -87,4 +87,4 @@ Thread.first_post = relation(Post, primaryjoin=and_(Post.thread_id == Thread.id,
 # 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), foreign_keys=[Post.thread_id], innerjoin=True, uselist=False, viewonly=True)
 
 # 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), foreign_keys=[Post.thread_id], innerjoin=True, uselist=False, viewonly=True)
 
-Post.author = relation(users_model.User, backref='posts')
+Post.author = relation(users_model.User, backref='posts', innerjoin=True)