Exemplo n.º 1
0
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
Exemplo n.º 2
0
def add():
    form = request.form
    print('!!project add form', form)
    # ImmutableMultiDict([('title', '的撒发射点法大师傅大师傅')])
    u = current_user()
    t = Project.inserProject(form, u, None)
    return t
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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
Exemplo n.º 5
0
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
Exemplo n.º 6
0
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'))
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
def index():
    u = current_user()
    if u is not None:
        # 若有用户
        return render_template("notes.html", user=u)
    else:
        # 若无用户
        return redirect(url_for('index.index'))
Exemplo n.º 9
0
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
Exemplo n.º 10
0
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))
Exemplo n.º 11
0
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)
Exemplo n.º 12
0
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)
Exemplo n.º 13
0
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)
Exemplo n.º 14
0
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)
Exemplo n.º 15
0
def chat():
    u = current_user()
    form = request.form
    print('!!friend chat form', form)
    t = Chat.add(form, u.user_id, form['userto'])
    return t
Exemplo n.º 16
0
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
Exemplo n.º 17
0
def all():
    u = current_user()
    list = Project.getAll(u, None)
    return (list)
Exemplo n.º 18
0
def add():
    form = request.form
    print('!!note add form', form)
    u = current_user()
    t = Note.inserNote(form, u, None)
    return t
Exemplo n.º 19
0
def all():
    u = current_user()
    list = User.get_all_friend(u)
    return (list)
Exemplo n.º 20
0
def all(gid):
    u = current_user()
    g = Group.get_one_by(group_id=gid)
    print(g)
    list = Tag.getAll(None, g)
    return (list)
Exemplo n.º 21
0
def add():
    form = request.form
    print('!!tag add form', form)
    u = current_user()
    t = Tag.inserTag(form, u, None)
    return t
Exemplo n.º 22
0
def add():
    form = request.form
    print('!!group add form', form)
    u = current_user()
    g = Group.addGroup(form, u)
    return g
Exemplo n.º 23
0
def all(gid):
    u=current_user()
    g = Group.get_one_by(group_id=gid)
    list = Note.getAll(None, g)
    return (list)
Exemplo n.º 24
0
def add():
    form = request.form
    print('!!friend add form', form)
    u = current_user()
    t = User.addfriend(form, u)
    return redirect(url_for('.index'))
Exemplo n.º 25
0
def all():
    u = current_user()
    list = Note.getAll(u, None)
    return (list)
Exemplo n.º 26
0
def p_all():
    u = current_user()
    list = Group.getpall(u)
    return list
Exemplo n.º 27
0
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)
Exemplo n.º 28
0
def all():
    u = current_user()
    list = Group.getAll(u, None)
    return list
Exemplo n.º 29
0
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))
Exemplo n.º 30
0
def participate():
    form = request.form
    print("!!group participate form", form)
    u = current_user()
    g = Group.participateGroup(form, u)
    return g