datatracker/ietf/person/migrations/0016_auto_20170203_1030.py
Ole Laursen ef251c6bc7 Add author affiliation chart.
Also add a model for registering an alias for an affiliation so that
we can group affiliations that are considered the same for statistical
purposes, and a model for registering unimportant endings like Inc.
and GmbH.

Affiliation grouping is done through three means: stripping
uninteresting endings, merging entries that only differ in case and
aliases that map from case-insensitive alias to name.

Stripping endings and merging based on case seem to reduce the number
of needed manually maintained aliases greatly.
 - Legacy-Id: 12785
2017-02-03 18:49:43 +00:00

30 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def add_affiliation_info(apps, schema_editor):
AffiliationAlias = apps.get_model("person", "AffiliationAlias")
AffiliationAlias.objects.get_or_create(alias="cisco", name="Cisco Systems")
AffiliationAlias.objects.get_or_create(alias="cisco system", name="Cisco Systems")
AffiliationAlias.objects.get_or_create(alias="cisco systems (india) private limited", name="Cisco Systems")
AffiliationAlias.objects.get_or_create(alias="cisco systems india pvt", name="Cisco Systems")
AffiliationIgnoredEnding = apps.get_model("person", "AffiliationIgnoredEnding")
AffiliationIgnoredEnding.objects.get_or_create(ending="LLC\.?")
AffiliationIgnoredEnding.objects.get_or_create(ending="Ltd\.?")
AffiliationIgnoredEnding.objects.get_or_create(ending="Inc\.?")
AffiliationIgnoredEnding.objects.get_or_create(ending="GmbH\.?")
class Migration(migrations.Migration):
dependencies = [
('person', '0015_affiliationalias_affiliationignoredending'),
]
operations = [
migrations.RunPython(add_affiliation_info, migrations.RunPython.noop)
]