mirror of
https://github.com/lucaspalomodevelop/indico-plugins.git
synced 2026-03-13 07:29:39 +00:00
Search: Use chain_titles column property
This commit is contained in:
parent
3e8396f5ae
commit
6aa12b226b
@ -18,6 +18,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from flask import request, jsonify
|
||||
from flask_pluginengine import current_plugin
|
||||
from sqlalchemy.orm import undefer
|
||||
from werkzeug.wrappers import Response
|
||||
|
||||
from indico.modules.categories import Category
|
||||
@ -60,10 +61,11 @@ class RHSearchCategoryTitles(RH):
|
||||
query = (Category.query
|
||||
.filter(Category.title_matches(request.args['term']),
|
||||
~Category.is_deleted)
|
||||
.options(undefer('chain_titles'))
|
||||
.order_by(Category.title))
|
||||
results = [{
|
||||
'title': category.title,
|
||||
'path': category.get_chain_titles()[1:-1],
|
||||
'path': category.chain_titles[1:-1],
|
||||
'url': unicode(category.url)
|
||||
} for category in query.limit(7)]
|
||||
return jsonify(success=True, results=results, count=query.count())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user