def edit(request): """ todo 首页的路由函数 """ todo_id = int(request.query['id']) t = Todo.one(id=todo_id) return html_response('todo_edit.html', todo_id=todo_id, todo_title=t.title)
def index(request): """ todo 首页的路由函数 """ u = current_user(request) ts = Todo.find_all(user_id=u.id) return html_response('todo_index.html', todos=ts)
def route_register_view(request): user = current_user(request) result = request.query.get('result', '') result = urllib.parse.unquote_plus(result) return html_response('register.html', result=result, username=user.username)
def index(request): """ weibo 首页的路由函数 """ u = current_user(request) ws = Weibo.find_all(user_id=u.id) return html_response('weibo_index.html', weibos=ws, user=u)
def edit(request): """ todo 首页的路由函数 """ # 替换模板文件中的标记字符串 todo_id = int(request.query['id']) t = Todo.find_by(id=todo_id) return html_response('todo_edit.html', todo_id=todo_id, todo_title=t.title)
def index(request): """ weibo 首页的路由函数 """ u = current_user(request) weibos = Weibo.all(user_id=u.id) # 替换模板文件中的标记字符串 return html_response('weibo_index.html', weibos=weibos, user=u)
def index(request): """ weibo 首页的路由函数 """ if 'user_id' in request.query: user_id = int(request.query['user_id']) else: u = current_user(request) user_id = u.id weibos = Weibo.all(user_id=user_id) return html_response('weibo_index.html', weibos=weibos)
def index(request): """ weibo 首页的路由函数 """ if 'user_id' in request.query: user_id = int(request.query['user_id']) else: u = current_user(request) user_id = u.id weibos = Weibo.all(user_id=user_id) for w in weibos: print('w.dict', w.__dict__) # 替换模板文件中的标记字符串 return html_response('weibo_index.html', weibos=weibos)
def route_login_view(request): """ 登录页面视图 """ log('login, headers', request.headers) log('login, cookies', request.cookies) user = current_user(request) log('current user', user) result = request.query.get('result', '') result = urllib.parse.unquote_plus(result) return html_response('login.html', result=result, username=user.username)
def comment_edit(request): comment_id = int(request.query['comment_id']) c = Comment.one(id=comment_id) return html_response('comment_edit.html', comment=c)
def edit(request): weibo_id = int(request.query['weibo_id']) w = Weibo.one(id=weibo_id) return html_response('weibo_edit.html', weibo=w)
def index(request): """ todo 首页的路由函数 """ u = current_user(request) return html_response('ajax_todo_index.html')
def message_view(request): ms = Message.all() return html_response('messages.html', messages=ms)
def route_ajax(request): """ 主页的处理函数, 返回主页的响应 """ return html_response('ajax.html')