responding to review comments
This commit is contained in:
parent
6b39052fcc
commit
575e1bac4c
4 changed files with 15 additions and 23 deletions
|
@ -18,16 +18,10 @@ def populate_sort_title(apps, schema_editor):
|
|||
articles = chain(
|
||||
*(LANGUAGE_ARTICLES.get(language, ()) for language in edition.languages)
|
||||
)
|
||||
if articles:
|
||||
icase_articles = (
|
||||
f"[{a[0].capitalize()}{a[0].lower()}]{a[1:]}" for a in articles
|
||||
)
|
||||
edition.sort_title = re.sub(
|
||||
f'^{" |^".join(icase_articles)} ', "", edition.title
|
||||
)
|
||||
else:
|
||||
edition.sort_title = edition.title
|
||||
edition.save()
|
||||
edition.sort_title = re.sub(
|
||||
f'^{" |^".join(articles)} ', "", str(edition.title).lower()
|
||||
)
|
||||
Edition.objects.bulk_update(editions_wo_sort_title, ["sort_title"])
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue