from flask import Flask, request, abort
from flask_sqlalchemy import SQLAlchemy
from flask import render_template
from datetime import datetime
from sqlalchemy import desc
from flask import render_template

app=Flask(__name__)
app.config[
    'SQLALCHEMY_DATABASE_URI'] ='postgres://brjgqjmnamwnxc:2038ec5ace178f7e6f34d1015384a39e7274126f60488b14a5403582ae5a8966@ec2-3-95-87-221.compute-1.amazonaws.com:5432/d3s7d1dsfli0sd'

app.config[
    'SQLALCHEMY_TRACK_MODIFICATIONS'] = True

db = SQLAlchemy(app)
groupId=0
class usermessage(db.Model):
    __tablename__ ='usermessage'
    id = db.Column(db.String(50), primary_key=True)
    group_num = db.Column(db.Text)
    nickname = db.Column(db.Text)
    group_id = db.Column(db.String(50))
    type = db.Column(db.Text)
    status = db.Column(db.Text)
    account = db.Column(db.Text)
    user_id = db.Column(db.String(50))
    message = db.Column(db.Text)
    birth_date = db.Column(db.TIMESTAMP)

@app.route('/',methods=['POST','GET'])
def index():
    if request.method == 'POST':
        userId = request.values['userId']
        # SetMsgNumber = usermessage.query.order_by(usermessage.birth_date).filter(usermessage.group_id==groupId).filter(usermessage.status=='set').count()
        data_UserData = usermessage.query.order_by(usermessage.birth_date).filter(usermessage.user_id==userId).filter(usermessage.status=='debt_set')
        UserString=''
        for _data in data_UserData:
            UserString += _data.nickname +' '
        new_list = UserString.strip('  ').split(' ')
        new_list=list(set(new_list)) #刪除重複

        return render_template('index_form.html',**locals())

    return render_template('home.html',**locals())


if __name__ =="__main__":
    app.run()

f02360cb7b73220fc0aa9ff37e445693d151e7ba
<mask token>


class usermessage(db.Model):
    __tablename__ = 'usermessage'
    id = db.Column(db.String(50), primary_key=True)
    group_num = db.Column(db.Text)
    nickname = db.Column(db.Text)
    group_id = db.Column(db.String(50))
    type = db.Column(db.Text)
    status = db.Column(db.Text)
    account = db.Column(db.Text)
    user_id = db.Column(db.String(50))
    message = db.Column(db.Text)
    birth_date = db.Column(db.TIMESTAMP)


<mask token>

<mask token>


class usermessage(db.Model):
    __tablename__ = 'usermessage'
    id = db.Column(db.String(50), primary_key=True)
    group_num = db.Column(db.Text)
    nickname = db.Column(db.Text)
    group_id = db.Column(db.String(50))
    type = db.Column(db.Text)
    status = db.Column(db.Text)
    account = db.Column(db.Text)
    user_id = db.Column(db.String(50))
    message = db.Column(db.Text)
    birth_date = db.Column(db.TIMESTAMP)


@app.route('/', methods=['POST', 'GET'])
def index():
    if request.method == 'POST':
        userId = request.values['userId']
        data_UserData = usermessage.query.order_by(usermessage.birth_date
            ).filter(usermessage.user_id == userId).filter(usermessage.
            status == 'debt_set')
        UserString = ''
        for _data in data_UserData:
            UserString += _data.nickname + ' '
        new_list = UserString.strip('  ').split(' ')
        new_list = list(set(new_list))
        return render_template('index_form.html', **locals())
    return render_template('home.html', **locals())


if __name__ == '__main__':
    app.run()

<mask token>
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = (
    'postgres://brjgqjmnamwnxc:2038ec5ace178f7e6f34d1015384a39e7274126f60488b14a5403582ae5a8966@ec2-3-95-87-221.compute-1.amazonaws.com:5432/d3s7d1dsfli0sd'
    )
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
db = SQLAlchemy(app)
groupId = 0


class usermessage(db.Model):
    __tablename__ = 'usermessage'
    id = db.Column(db.String(50), primary_key=True)
    group_num = db.Column(db.Text)
    nickname = db.Column(db.Text)
    group_id = db.Column(db.String(50))
    type = db.Column(db.Text)
    status = db.Column(db.Text)
    account = db.Column(db.Text)
    user_id = db.Column(db.String(50))
    message = db.Column(db.Text)
    birth_date = db.Column(db.TIMESTAMP)


@app.route('/', methods=['POST', 'GET'])
def index():
    if request.method == 'POST':
        userId = request.values['userId']
        data_UserData = usermessage.query.order_by(usermessage.birth_date
            ).filter(usermessage.user_id == userId).filter(usermessage.
            status == 'debt_set')
        UserString = ''
        for _data in data_UserData:
            UserString += _data.nickname + ' '
        new_list = UserString.strip('  ').split(' ')
        new_list = list(set(new_list))
        return render_template('index_form.html', **locals())
    return render_template('home.html', **locals())


if __name__ == '__main__':
    app.run()

from flask import Flask, request, abort
from flask_sqlalchemy import SQLAlchemy
from flask import render_template
from datetime import datetime
from sqlalchemy import desc
from flask import render_template
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = (
    'postgres://brjgqjmnamwnxc:2038ec5ace178f7e6f34d1015384a39e7274126f60488b14a5403582ae5a8966@ec2-3-95-87-221.compute-1.amazonaws.com:5432/d3s7d1dsfli0sd'
    )
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
db = SQLAlchemy(app)
groupId = 0


class usermessage(db.Model):
    __tablename__ = 'usermessage'
    id = db.Column(db.String(50), primary_key=True)
    group_num = db.Column(db.Text)
    nickname = db.Column(db.Text)
    group_id = db.Column(db.String(50))
    type = db.Column(db.Text)
    status = db.Column(db.Text)
    account = db.Column(db.Text)
    user_id = db.Column(db.String(50))
    message = db.Column(db.Text)
    birth_date = db.Column(db.TIMESTAMP)


@app.route('/', methods=['POST', 'GET'])
def index():
    if request.method == 'POST':
        userId = request.values['userId']
        data_UserData = usermessage.query.order_by(usermessage.birth_date
            ).filter(usermessage.user_id == userId).filter(usermessage.
            status == 'debt_set')
        UserString = ''
        for _data in data_UserData:
            UserString += _data.nickname + ' '
        new_list = UserString.strip('  ').split(' ')
        new_list = list(set(new_list))
        return render_template('index_form.html', **locals())
    return render_template('home.html', **locals())


if __name__ == '__main__':
    app.run()

from flask import Flask, request, abort
from flask_sqlalchemy import SQLAlchemy
from flask import render_template
from datetime import datetime
from sqlalchemy import desc
from flask import render_template

app=Flask(__name__)
app.config[
    'SQLALCHEMY_DATABASE_URI'] ='postgres://brjgqjmnamwnxc:2038ec5ace178f7e6f34d1015384a39e7274126f60488b14a5403582ae5a8966@ec2-3-95-87-221.compute-1.amazonaws.com:5432/d3s7d1dsfli0sd'

app.config[
    'SQLALCHEMY_TRACK_MODIFICATIONS'] = True

db = SQLAlchemy(app)
groupId=0
class usermessage(db.Model):
    __tablename__ ='usermessage'
    id = db.Column(db.String(50), primary_key=True)
    group_num = db.Column(db.Text)
    nickname = db.Column(db.Text)
    group_id = db.Column(db.String(50))
    type = db.Column(db.Text)
    status = db.Column(db.Text)
    account = db.Column(db.Text)
    user_id = db.Column(db.String(50))
    message = db.Column(db.Text)
    birth_date = db.Column(db.TIMESTAMP)

@app.route('/',methods=['POST','GET'])
def index():
    if request.method == 'POST':
        userId = request.values['userId']
        # SetMsgNumber = usermessage.query.order_by(usermessage.birth_date).filter(usermessage.group_id==groupId).filter(usermessage.status=='set').count()
        data_UserData = usermessage.query.order_by(usermessage.birth_date).filter(usermessage.user_id==userId).filter(usermessage.status=='debt_set')
        UserString=''
        for _data in data_UserData:
            UserString += _data.nickname +' '
        new_list = UserString.strip('  ').split(' ')
        new_list=list(set(new_list)) #刪除重複

        return render_template('index_form.html',**locals())

    return render_template('home.html',**locals())


if __name__ =="__main__":
    app.run()
