# -*- coding: utf-8 -*- from frontend.models import PersonGlobalIdentity, CitaviProjectIdentity class PersonIdentityManager(): def create_identity(self, project, uuid): pgi = PersonGlobalIdentity(type='citavi') pgi.save() cpi = CitaviProjectIdentity(global_identity=pgi, project=project, citavi_uuid=uuid, preferred_id=True) cpi.save() return cpi def add_identity_to_global_identity(self, global_identity, project, uuid, preferred): cpi = CitaviProjectIdentity(global_identity=global_identity, project=project, citavi_uuid=uuid, preferred_id=True) cpi.save() return cpi def get_global_identities(self): return PersonGlobalIdentity.objects.all() def get_mapped_identities_for_project(self, project): return CitaviProjectIdentity.objects.filter(project=project).all()