nopaque/app/corpora/utils.py

18 lines
481 B
Python
Raw Normal View History

2023-03-14 11:13:35 +01:00
from flask import request, url_for
from app.models import Corpus
def corpus_endpoint_arguments_constructor():
return {'corpus_id': request.view_args['corpus_id']}
def corpus_dynamic_list_constructor():
corpus_id = request.view_args['corpus_id']
2023-03-14 11:44:15 +01:00
corpus = Corpus.query.get_or_404(corpus_id)
2023-03-14 11:13:35 +01:00
return [
{
'text': f'<i class="material-icons left">book</i>{corpus.title}',
'url': url_for('.corpus', corpus_id=corpus_id)
}
]