mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
14 lines
351 B
Python
14 lines
351 B
Python
from app import db
|
|
from app.decorators import background
|
|
from app.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(f'User {user_id} not found')
|
|
user.delete()
|
|
db.session.commit()
|