nopaque/app/users/utils.py

18 lines
458 B
Python
Raw Normal View History

2023-03-14 10:44:15 +00:00
from flask import request, url_for
from app.models import User
def user_endpoint_arguments_constructor():
return {'user_id': request.view_args['user_id']}
def user_dynamic_list_constructor():
user_id = request.view_args['user_id']
user = User.query.get_or_404(user_id)
return [
{
2023-03-14 13:21:23 +00:00
'text': f'<i class="material-icons left">person</i>{user.username}',
2023-03-14 10:44:15 +00:00
'url': url_for('.user', user_id=user_id)
}
]