diff --git a/calaccess_processed/models/proxies/opencivicdata/people.py b/calaccess_processed/models/proxies/opencivicdata/people.py index 26bd5b26..77903b79 100644 --- a/calaccess_processed/models/proxies/opencivicdata/people.py +++ b/calaccess_processed/models/proxies/opencivicdata/people.py @@ -12,8 +12,8 @@ PersonIdentifier, PersonName, ) -from .base import OCDProxyModelMixin from postgres_copy import CopyQuerySet +from .base import OCDProxyModelMixin class OCDPersonManager(models.Manager): @@ -71,6 +71,7 @@ def merge(self, persons): Return the merged Person object. """ + from calaccess_processed.models import OCDCandidacyProxy # each person will be merged into this one keep = persons.pop(0) @@ -111,6 +112,8 @@ def merge(self, persons): else: cand_to_keep = cands.latest('filed_date') + cand_to_keep.__class__ = OCDCandidacyProxy + # loop over all the other candidacies in the group for cand_to_discard in cands.exclude(id=cand_to_keep.id).all(): # assuming there's nothing else to preserve in extras