rename api, sortName->getSortName; add getSortTitle: fixes #2605
This commit is contained in:
parent
39cdfc131b
commit
ebcd419854
2 changed files with 25 additions and 2 deletions
|
@ -43,7 +43,7 @@ def editName(request, data):
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(editName, cache=False)
|
actions.register(editName, cache=False)
|
||||||
|
|
||||||
def sortName(request, data):
|
def getSortName(request, data):
|
||||||
'''
|
'''
|
||||||
Gets the sort name for one or more names
|
Gets the sort name for one or more names
|
||||||
takes {
|
takes {
|
||||||
|
@ -64,7 +64,7 @@ def sortName(request, data):
|
||||||
for name in names:
|
for name in names:
|
||||||
response['data'][name] = models.get_name_sort(name)
|
response['data'][name] = models.get_name_sort(name)
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(sortName, cache=False)
|
actions.register(getSortName, cache=False)
|
||||||
|
|
||||||
def parse_query(data, user):
|
def parse_query(data, user):
|
||||||
query = {}
|
query = {}
|
||||||
|
|
|
@ -43,6 +43,29 @@ def editTitle(request, data):
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(editTitle, cache=False)
|
actions.register(editTitle, cache=False)
|
||||||
|
|
||||||
|
def getSortTitle(request, data):
|
||||||
|
'''
|
||||||
|
Gets the sort title for one or more titles
|
||||||
|
takes {
|
||||||
|
title: string, // either title
|
||||||
|
titles: [string] // or list of titles
|
||||||
|
}
|
||||||
|
returns {
|
||||||
|
title: sortTitle, // sort title for this title
|
||||||
|
... // more results
|
||||||
|
}
|
||||||
|
see: editTitle, findTitles
|
||||||
|
'''
|
||||||
|
titles = data.get('titles', [])
|
||||||
|
if 'title' in data:
|
||||||
|
titles.append(data['title'])
|
||||||
|
response = json_response()
|
||||||
|
response['data'] = {}
|
||||||
|
for title in titles:
|
||||||
|
response['data'][title] = models.get_title_sort(title)
|
||||||
|
return render_to_json_response(response)
|
||||||
|
actions.register(getSortTitle, cache=False)
|
||||||
|
|
||||||
def parse_query(data, user):
|
def parse_query(data, user):
|
||||||
query = {}
|
query = {}
|
||||||
query['range'] = [0, 100]
|
query['range'] = [0, 100]
|
||||||
|
|
Loading…
Reference in a new issue