This commit is contained in:
j 2011-10-11 17:31:05 +02:00
commit 590c7c45ac
4 changed files with 12 additions and 12 deletions

View file

@ -55,7 +55,7 @@ class Title(models.Model):
j = {
'id': self.get_id(),
'title': self.title,
'titleSort': self.title_sort,
'sortTitle': self.title_sort,
}
if keys:
for key in j.keys():

View file

@ -21,15 +21,15 @@ def editTitle(request):
'''
param data {
'id': titleid,
'titleSort': ...
'sortTitle': ...
}
can contain any of the allowed keys for title
'''
data = json.loads(request.POST['data'])
title = get_object_or_404_json(models.Title, pk=ox.from26(data['id']))
response = json_response()
if 'titleSort' in data:
title.title_sort = data['titleSort']
if 'sortTitle' in data:
title.title_sort = data['sortTitle']
title.title_sort = unicodedata.normalize('NFKD', title.title_sort)
title.edited = True
title.save()
@ -57,7 +57,7 @@ def order_query(qs, sort):
if operator != '-':
operator = ''
key = {
'titleSort': 'title_sort',
'sortTitle': 'title_sort',
}.get(e['key'], e['key'])
order = '%s%s' % (operator, key)
order_by.append(order)
@ -90,7 +90,7 @@ def findTitles(request):
title, numberoftitles
possible keys:
title, titleSort, numberoftitles
title, sortTitle, numberoftitles
return {
status: {