Add script to clean member names
This commit is contained in:
parent
091c81e411
commit
ba5361f660
24
apiserver/clean_member_names.py
Executable file
24
apiserver/clean_member_names.py
Executable 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.')
|
Loading…
Reference in New Issue
Block a user