1
0
Fork 0

Clean url arguments on request and correct arguments form dependences

This commit is contained in:
Ethanell 2019-05-01 16:32:00 +02:00
parent 95c70b0b48
commit f81ad0ecd5

View file

@ -118,6 +118,7 @@ def dashboard():
db.session.commit() db.session.commit()
if request.args.get("delet"): if request.args.get("delet"):
twapi.destroy_status(request.args.get["twrm"]) twapi.destroy_status(request.args.get["twrm"])
return redirect(url_for("dashboard"))
elif "tweet" in request.form and "slots" in request.form and "keywords" in request.form: elif "tweet" in request.form and "slots" in request.form and "keywords" in request.form:
try: try:
slots = int(request.form["slots"]) slots = int(request.form["slots"])
@ -127,12 +128,7 @@ def dashboard():
else: else:
db.session.add(Tweets(user = current_user, statu_id = tweet, slots = 0, slots_max = slots, keywords = str(request.form["keywords"].split(",")))) db.session.add(Tweets(user = current_user, statu_id = tweet, slots = 0, slots_max = slots, keywords = str(request.form["keywords"].split(","))))
db.session.commit() db.session.commit()
elif "board" in request.form: return redirect(url_for("dashboard"))
db.session.add(Boards(user = current_user, board_id = request.form["board"]))
db.session.commit()
elif "column" in request.form:
current_user.boards.first().column_id = request.form["column"]
db.session.commit()
for t in Tweets.query.filter_by(user = current_user): for t in Tweets.query.filter_by(user = current_user):
statu = twapi.get_status(t.statu_id) statu = twapi.get_status(t.statu_id)
@ -150,6 +146,16 @@ def dashboard():
if trapi: if trapi:
trapi = trapi.api_login() trapi = trapi.api_login()
if "board" in request.form:
db.session.add(Boards(user = current_user, board_id = request.form["board"]))
db.session.commit()
return redirect(url_for("dashboard"))
elif "column" in request.form:
current_user.boards.first().column_id = request.form["column"]
db.session.commit()
return redirect(url_for("dashboard"))
for b in trapi.list_boards(): for b in trapi.list_boards():
select = False select = False
if current_user.boards.first() and b.id == current_user.boards.first().board_id: if current_user.boards.first() and b.id == current_user.boards.first().board_id: