Add script to clean member names

This commit is contained in:
Tanner Collin 2020-02-28 07:22:46 +00:00
parent 091c81e411
commit ba5361f660

24
apiserver/clean_member_names.py Executable file
View File

@ -0,0 +1,24 @@
import django, sys, os
os.environ['DJANGO_SETTINGS_MODULE'] = 'apiserver.settings'
django.setup()
import datetime
import json
from apiserver.api import models, old_models, utils
members = models.Member.objects.all()
for m in members:
first_name = m.first_name
last_name = m.last_name
preferred_name = m.preferred_name
print('Updating:', first_name, last_name, '-->', first_name.title(), last_name.title())
models.Member.objects.filter(id=m.id).update(
first_name=first_name.title().strip(),
last_name=last_name.title().strip(),
preferred_name=preferred_name.title().strip(),
)
print('Done.')