def blog_default(request): bloger = Blog.all().filter('url =', 'http://blog.sina.com.cn/sjxxh').get() if not bloger: bloger = Blog(author = 'Monkeyking',service_provider = 'sina',url = 'http://blog.sina.com.cn/sjxxh') bloger.put() return blog(request, bloger.key())
def index(request): blogs = Blog.all().order('-url') blog_list = [(target.author,target.key()) for target in blogs] return render_to_response('blog_list.html', {'blog_list':blog_list})