def chatre(): u = current_user() form = request.get_json() print('!!friend chatre form', form) t = Chat.chatall(u.user_id, form['userto'], form['last']) return t pass
def add(): form = request.form print('!!project add form', form) # ImmutableMultiDict([('title', '的撒发射点法大师傅大师傅')]) u = current_user() t = Project.inserProject(form, u, None) return t
def check(gid): json = request.get_json() g = Group.get_one_by(group_id=gid) print('!!check json', json) u = current_user() result_id = Todo.toggleTodoGroup(json, u, g) return result_id
def add(gid): form = request.form print('!!note add form', form) u = current_user() g = Group.get_one_by(group_id=gid) t = Note.inserNote(form, u, g) return t
def add(gid): form = request.form print('!!tag add form', form) u = current_user() g = Group.get_one_by(group_id=gid) t = Tag.inserTag(form, u, g) return t
def add(): form = request.form u = current_user() m = Topic.new(form, user_id=u.id) print(u) # return redirect(url_for('.detail', id=m.id)) return redirect(url_for('.index'))
def new(): u = current_user() if u is None: # 转到 topic.index 页面 # return redirect(url_for('topic.index')) return redirect(url_for("index.loginpage")) bs = Board.all() return render_template("topic/new.html", bs=bs)
def index(): u = current_user() if u is not None: # 若有用户 return render_template("notes.html", user=u) else: # 若无用户 return redirect(url_for('index.index'))
def add(gid): form = request.form print('!!project add form', form) # ImmutableMultiDict([('title', '的撒发射点法大师傅大师傅')]) u = current_user() g = Group.get_one_by(group_id=gid) t = Project.inserProject(form, u, g) return t
def add(gid): form = request.form print('!!add form', form) # ImmutableMultiDict([('title', '的撒发射点法大师傅大师傅')]) u = current_user() # u代表user g = Group.get_one_by(group_id=gid) t = Todo.inserTodo(form, u, g) s = '.' + gid return redirect(url_for(".index", gid=gid))
def all(gid): u = current_user() gu = Group.get_one_by(group_id=gid).users list = [] for g in gu: t = dict( name=g.name, icon=g.icon, email=g.email ) list.append(t) print(list) return json.dumps(list)
def index(): # board_id = 2 board_id = int(request.args.get('board_id', -1)) if board_id == -1: ms = Topic.all() else: ms = Topic.find_all(board_id=board_id) token = str(uuid.uuid4()) u = current_user() bs = Board.all() if u == None: return render_template("topic/index2.html", ms=ms, bs=bs) csrf_tokens['token'] = u.id return render_template("topic/index.html", ms=ms, token=token, bs=bs, user = u)
def delete(): id = int(request.args.get('id')) token = request.args.get('token') u = current_user() # 判断 token 是否是我们给的 if token in csrf_tokens and csrf_tokens[token] == u.id: csrf_tokens.pop(token) if u is not None: print('删除 topic 用户是', u, id) Topic.delete(id) return redirect(url_for('.index')) else: abort(404) else: abort(403)
def all(gid): u = current_user() gu = Group.get_one_by(group_id=gid).users list = [] for g in gu: t = dict(name=g.name, icon=g.icon, email=g.email, performance=g.performance) list.append(t) def takep(u): return u['performance'] list.sort(key=takep, reverse=True) # 降序 print(list) return json.dumps(list)
def chat(): u = current_user() form = request.form print('!!friend chat form', form) t = Chat.add(form, u.user_id, form['userto']) return t
def chatall(): u = current_user() form = request.get_json() print('!!friend chatall form', form) t = Chat.chatall(u.user_id, form['userto'], None) return t
def all(): u = current_user() list = Project.getAll(u, None) return (list)
def add(): form = request.form print('!!note add form', form) u = current_user() t = Note.inserNote(form, u, None) return t
def all(): u = current_user() list = User.get_all_friend(u) return (list)
def all(gid): u = current_user() g = Group.get_one_by(group_id=gid) print(g) list = Tag.getAll(None, g) return (list)
def add(): form = request.form print('!!tag add form', form) u = current_user() t = Tag.inserTag(form, u, None) return t
def add(): form = request.form print('!!group add form', form) u = current_user() g = Group.addGroup(form, u) return g
def all(gid): u=current_user() g = Group.get_one_by(group_id=gid) list = Note.getAll(None, g) return (list)
def add(): form = request.form print('!!friend add form', form) u = current_user() t = User.addfriend(form, u) return redirect(url_for('.index'))
def all(): u = current_user() list = Note.getAll(u, None) return (list)
def p_all(): u = current_user() list = Group.getpall(u) return list
def index(gid): u = current_user() g = Group.get_one_by(group_id=gid) print(g) return render_template("g_performance.html", user=u, group=g)
def all(): u = current_user() list = Group.getAll(u, None) return list
def add(): form = request.form u = current_user() print('DEBUG', form) m = Reply.new(form, user_id=u.id) return redirect(url_for('topic.detail', id=m.topic_id))
def participate(): form = request.form print("!!group participate form", form) u = current_user() g = Group.participateGroup(form, u) return g