@@ -0,0 +1,1158 @@
+from __future__ import absolute_import%0A%0Afrom django.core.management.base import BaseCommand%0A%0Afrom zephyr.lib.actions import do_change_full_name%0Afrom zephyr.models import UserProfile, get_user_profile_by_email%0A%0Aclass Command(BaseCommand):%0A    help = %22%22%22Change the names for many users.%0A%0AUsage: python manage.py bulk_change_user_name %3Cdata file%3E%0A%0AWhere %3Cdata file%3E contains rows of the form %3Cemail%3E,%3Cdesired name%3E.%22%22%22%0A%0A    def handle(self, *args, **options):%0A        if len(args) != 1:%0A            print %22Please provide a CSV file mapping emails to desired names.%22%0A            exit(1)%0A%0A        data_file = args%5B0%5D%0A        with open(data_file, %22r%22) as f:%0A            for line in f:%0A                email, new_name = line.strip().split(%22,%22, 1)%0A%0A                try:%0A                    user_profile = get_user_profile_by_email(email)%0A                    old_name = user_profile.full_name%0A                    print %22%25s: %25s -%3E %25s%22 %25 (email, old_name, new_name)%0A                    do_change_full_name(user_profile, new_name)%0A                except UserProfile.DoesNotExist:%0A                    print %22* E-mail %25s doesn't exist in the system, skipping.%22 %25 (email,)%0A

Add a bulk_change_user_name management command.