Exemplo n.º 1
0
def user_info(id_='me'):
    if not current_user:
        flash('Plz login or regist')
        return redirect('login')
    if id_ == 'me':
        user = current_user
    else:
        user = User.get_or_404(id=id_)
    return render_template('user.html', user=user)
Exemplo n.º 2
0
def group_chat(id_=None):
    form = MessageForm()
    if request.method == 'POST':
        content = form.data.content
        send2 = form.data.send2
        send2user = User.get_or_404(id=send2)
        message = Message(create_by=current_user.id,
                          content=content,
                          send2=send2)
        message.save()
    msgs = Message.objects(send2=id_)
    return render_template('/group_chat.html', msgs=msgs, form=form)