share now changes shareid for owner of card, almost fixing the bug
parent
ce72547bec
commit
314acb358a
6
share.py
6
share.py
|
@ -5,7 +5,7 @@ from create_db import User, Card, get_session
|
||||||
|
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
|
|
||||||
|
#@TODO najbrž je treba narediti tako da org card tudi dobi share id in se ostalo, kar to obsega
|
||||||
def share(card, user_id):
|
def share(card, user_id):
|
||||||
dbsession = get_session()
|
dbsession = get_session()
|
||||||
|
|
||||||
|
@ -13,6 +13,10 @@ def share(card, user_id):
|
||||||
h = md5(str(card.id).encode("utf-8")).hexdigest()
|
h = md5(str(card.id).encode("utf-8")).hexdigest()
|
||||||
card.share_id = h
|
card.share_id = h
|
||||||
|
|
||||||
|
owner_card = dbsession.query(Card).filter(Card.id == card.id).first()
|
||||||
|
owner_card.share_id = h
|
||||||
|
dbsession.commit()
|
||||||
|
|
||||||
# all users
|
# all users
|
||||||
users = dbsession.query(User).filter(User.id != user_id).all()
|
users = dbsession.query(User).filter(User.id != user_id).all()
|
||||||
for user in users:
|
for user in users:
|
||||||
|
|
Loading…
Reference in New Issue