datatracker/ietf/bin/merge-person-records
Robert Sparks dc5ae398f2 Improved SearchablePersonField to show the primary email address for any search results where a name appears more than once.
Simplified the edit nominee form.
Replaced the merge nominee form with a request to the secretariat to merge Person records. Fixes #1847.
Added merging nominees to the secretariat's person merging script.
Restructured the person merging script to make it testable.
Updated some tests to match changes to the mailtriggers that hadn't made it to the fixtures.
 - Legacy-Id: 10625
2015-12-22 21:42:55 +00:00

33 lines
852 B
Python
Executable file

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- Python -*-
#
import os, sys
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
sys.path = [ basedir ] + sys.path
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ietf.settings")
import django
django.setup()
import argparse
from ietf.person.models import Person
from ietf.person.utils import merge_persons
parser = argparse.ArgumentParser()
parser.add_argument("source_id",type=int)
parser.add_argument("target_id",type=int)
args = parser.parse_args()
source = Person.objects.get(pk=args.source_id)
target = Person.objects.get(pk=args.target_id)
print "Merging person {}({}) to {}({})".format(source.ascii,source.pk,target.ascii,target.pk)
response = raw_input('Ok to continue y/n? ')
if response.lower() != 'y':
sys.exit()
merge_persons(source,target,sys.stdout)