update_sort functions

This commit is contained in:
j 2011-10-11 17:23:31 +02:00
parent 634190cca6
commit 2ab76ce1c9
2 changed files with 21 additions and 0 deletions

View file

@ -70,3 +70,14 @@ class Person(models.Model):
if key not in keys:
del j[key]
return j
def update_sort_name():
for p in Person.objects.all():
_name_sort = ox.get_sort_name(p.name)
_name_sort = unicodedata.normalize('NFKD', _name_sort)
if (not p.edited and _name_sort != p.name_sort) or \
(p.edited and _name_sort == p.name_sort):
p.name_sort = _name_sort
p.edited = False
p.save()

View file

@ -62,3 +62,13 @@ class Title(models.Model):
if key not in keys:
del j[key]
return j
def update_sort_title():
for t in Title.objects.all():
_title_sort = ox.get_sort_title(t.title)
_title_sort = unicodedata.normalize('NFKD', _title_sort)
if (not t.edited and _title_sort != t.title_sort) or \
(t.edited and _title_sort == t.title_sort):
t.title_sort = _title_sort
t.edited = False
t.save()