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

View file

@ -62,7 +62,7 @@ class Person(models.Model):
j = {
'id': self.get_id(),
'name': self.name,
'nameSort': self.name_sort,
'sortName': self.name_sort,
'numberofnames': self.numberofnames,
}
if keys:

View file

@ -20,15 +20,15 @@ def editName(request):
'''
param data {
'id': nameid,
'nameSort': ...
'sortName': ...
}
can contain any of the allowed keys for name
'''
data = json.loads(request.POST['data'])
person = get_object_or_404_json(models.Person, pk=ox.from26(data['id']))
response = json_response()
if 'nameSort' in data:
person.name_sort = utils.sort_string(data['nameSort'])
if 'sortName' in data:
person.name_sort = utils.sort_string(data['sortName'])
person.edited = True
person.save()
response['data'] = person.json()
@ -56,7 +56,7 @@ def order_query(qs, sort):
operator = ''
key = {
'name': 'name_sort',
'nameSort': 'name_sort',
'sortName': 'name_sort',
}.get(e['key'], e['key'])
order = '%s%s' % (operator, key)
order_by.append(order)
@ -89,7 +89,7 @@ def findNames(request):
name, numberofnames
possible keys:
name, nameSort, numberofnames
name, sortName, numberofnames
return {
status: {

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: {