예제 #1
0
 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)
예제 #2
0
	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'])
예제 #3
0
	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
예제 #4
0
	def rss(self):
		p = Post.all()
		p.order('-posted_on').filter('status =', 'Published')
		self.posts = self.from_cache('blog_last10', lambda: p.fetch(10))
예제 #5
0
	def index(self):
		p = Post.all().order('-posted_on').filter('status =', 'Published')
		self.page(p, 'blog_index_page_')
예제 #6
0
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())
예제 #7
0
def list_posts():
    result = {"result": []}
    for post in Post.all():
        result["result"].append(post.to_dict())
    return json.dumps(result)
예제 #8
0
 def index(self, author=None):
     posts = Post.all()
     return self.render("/post/index", posts=posts)