nopaque/app/corpora/utils.py

18 lines
481 B
Python
Raw Permalink Normal View History

2023-03-14 10:13:35 +00: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 10:44:15 +00:00
corpus = Corpus.query.get_or_404(corpus_id)
2023-03-14 10:13:35 +00:00
return [
{
'text': f'<i class="material-icons left">book</i>{corpus.title}',
'url': url_for('.corpus', corpus_id=corpus_id)
}
]