check if user already added to task
This commit is contained in:
parent
e615f774ad
commit
d71cde1171
@ -8,4 +8,4 @@ Depends: gunicorn, python3-flask-sqlalchemy
|
|||||||
Homepage: https://gitea.dmz.rs/Decentrala/taskmanager
|
Homepage: https://gitea.dmz.rs/Decentrala/taskmanager
|
||||||
Maintainer: Decentrala <dmz@dmz.rs>
|
Maintainer: Decentrala <dmz@dmz.rs>
|
||||||
Description: Interactive TODO list Web app
|
Description: Interactive TODO list Web app
|
||||||
Version: 1.0.3
|
Version: 1.0.5
|
||||||
|
@ -107,6 +107,13 @@ def project(task_id:int):
|
|||||||
return 'User not found, please <a href="/register">register</a>.'
|
return 'User not found, please <a href="/register">register</a>.'
|
||||||
if userid is None:
|
if userid is None:
|
||||||
return 'User not found, please <a href="/register">register</a>.'
|
return 'User not found, please <a href="/register">register</a>.'
|
||||||
|
# check if user already added
|
||||||
|
try:
|
||||||
|
existinguser = TaskUser.query.filter_by(userid = userid, taskid = taskid ).first().userid
|
||||||
|
except:
|
||||||
|
existingusers = None
|
||||||
|
if existingusers == userid :
|
||||||
|
return "User already added"
|
||||||
sqladduser = TaskUser(userid = userid, taskid = task_id)
|
sqladduser = TaskUser(userid = userid, taskid = task_id)
|
||||||
try:
|
try:
|
||||||
db.session.add(sqladduser)
|
db.session.add(sqladduser)
|
||||||
|
Loading…
Reference in New Issue
Block a user