nopaque/web/app/settings/tasks.py
Patrick Jentsch f4be897c73 Fix
2020-10-26 11:17:25 +01:00

14 lines
354 B
Python

from .. import db
from ..decorators import background
from ..models import User
@background
def delete_user(user_id, *args, **kwargs):
with kwargs['app'].app_context():
user = User.query.get(user_id)
if user is None:
raise Exception('User {} not found'.format(user_id))
user.delete()
db.session.commit()