@@ -0,0 +1,734 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Aimport re%0A%0Afrom django.db import migrations%0A%0A%0Adef adjust_roles_for_grouping(apps, schema_editor):%0A    Election = apps.get_model('elections', 'Election')%0A    for election in Election.objects.all():%0A        if re.search(r'%5Elocal%5C.%5B%5E.%5D+%5C.2016', election.slug):%0A            election.for_post_role = 'Local Councillor'%0A            election.save()%0A        if re.search(r'%5Emayor%5C.%5B%5E.%5D+%5C.2016', election.slug):%0A            election.for_post_role = 'Mayor'%0A            election.save()%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A    dependencies = %5B%0A        ('uk', '0002_remove-gb-prefix'),%0A    %5D%0A%0A    operations = %5B%0A        migrations.RunPython(adjust_roles_for_grouping),%0A    %5D%0A

Change for_post_role of local & mayoral elections for better grouping