Esempio n. 1
0
    def handle(*args, **opts):
        args = args[1:]

        people_to_merge = Person.objects.filter(pk__in=[int(i) for i in args])
        person_to_spare = Person.objects.get(pk=opts['into'])
        print 'merging', people_to_merge, 'into', person_to_spare
        merge_people(people_to_merge, into=person_to_spare)
Esempio n. 2
0
def merge_selected_people(modeladmin, request, queryset):
    if queryset.count() < 2:
        return

    from core.merge_people import find_best_candidate, merge_people

    person_to_spare, people_to_merge = find_best_candidate(queryset)
    merge_people(people_to_merge, into=person_to_spare)
Esempio n. 3
0
def merge_selected_people(modeladmin, request, queryset):
    if queryset.count() < 2:
        return

    from core.merge_people import find_best_candidate, merge_people

    person_to_spare, people_to_merge = find_best_candidate(queryset)
    merge_people(people_to_merge, into=person_to_spare)
Esempio n. 4
0
    def handle(*args, **opts):
        for email in Person.objects.all().values_list('email', flat=True).distinct():
            if not email:
                continue

            people = Person.objects.filter(email=email)
            if people.count() > 1:
                print email
                for person_to_spare, people_to_merge in possible_merges(people):
                    merge_people(people_to_merge, into=person_to_spare)
Esempio n. 5
0
    def handle(*args, **opts):
        for email in Person.objects.all().values_list('email',
                                                      flat=True).distinct():
            if not email:
                continue

            people = Person.objects.filter(email=email)
            if people.count() > 1:
                print(email)
                for person_to_spare, people_to_merge in possible_merges(
                        people):
                    merge_people(people_to_merge, into=person_to_spare)