Open GoogleCodeExporter opened 8 years ago
我理解的置顶好像没有那么复杂. 就是按sticky排序嘛.
我在默认的按日期排序下, 增加了一个按sticky的排序方式.
只改blog.py中的一行, 还是在doget方法中:
entries = Entry.all().filter('entrytype =','post').\
filter("published =", True).order('-sticky').order('-date').\
fetch(self.blog.posts_per_page, offset = (page-1) * self.blog.posts_per_page)
不需要改任何模板, 因为都是默认用的是entries这个集合.
结果就是sticky的post一定先出来排在页面上面.
下面才是按日期排序(默认)的其他文章.
如果我理解的置顶是这个意思, 那么这应该是正解.
Original comment by geo...@gmail.com
on 26 Jun 2011 at 12:48
补充一下,
部署完毕第一次跑的时候有个报错说你的索引没有更新,
然后错误的最后很体贴的给了你应该新建的索引代码.
这几行粘贴到index.yaml文件最后. 再部署一次应该就好了.
Original comment by geo...@gmail.com
on 26 Jun 2011 at 12:53
Original issue reported on code.google.com by
qhm...@gmail.com
on 14 Oct 2010 at 11:20