from flask import request, url_for from app.models import Job def job_dynamic_list_constructor(): job_id = request.view_args['job_id'] job = Job.query.get_or_404(job_id) return [ { 'text': f'{job.title}', 'url': url_for('.job', job_id=job_id) } ]