def get(self): """ This renders home page with all posts, sorted by date. """ deleted_post_id = self.request.get('deleted_post_id') posts = greetings = Post.all().order('-created') self.render('front.html', posts=posts, deleted_post_id=deleted_post_id)
def tag(self): p = Post.all().order('-posted_on').filter('tags =', self.params['id']).filter('status =', 'Published') self.tagged = self.params['id'] self.page(p, 'blog_tag_' + self.params['id'])
def search(self): term = self.params.get('q', None) self.posts = Post.all().search(term).filter('status =', 'Published').order('-posted_on') self.has_results = self.posts.count() self.search_term = term
def rss(self): p = Post.all() p.order('-posted_on').filter('status =', 'Published') self.posts = self.from_cache('blog_last10', lambda: p.fetch(10))
def index(self): p = Post.all().order('-posted_on').filter('status =', 'Published') self.page(p, 'blog_index_page_')
def list_posts(): #result = {"result": []} # post in Post.all(): # result["result"].append(post.to_dict()) #return json.dumps(result) return render_template("posts.html", posts=Post.all())
def list_posts(): result = {"result": []} for post in Post.all(): result["result"].append(post.to_dict()) return json.dumps(result)
def index(self, author=None): posts = Post.all() return self.render("/post/index", posts=posts)