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 = { j = {
'id': self.get_id(), 'id': self.get_id(),
'name': self.name, 'name': self.name,
'nameSort': self.name_sort, 'sortName': self.name_sort,
'numberofnames': self.numberofnames, 'numberofnames': self.numberofnames,
} }
if keys: if keys:

View file

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

View file

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

View file

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