diff --git a/pandora/person/models.py b/pandora/person/models.py index 53ac4e88..4beb62e5 100644 --- a/pandora/person/models.py +++ b/pandora/person/models.py @@ -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() diff --git a/pandora/title/models.py b/pandora/title/models.py index abf1aa51..e5e36fde 100644 --- a/pandora/title/models.py +++ b/pandora/title/models.py @@ -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()