From 39e0a2b89a2ddadb15c96cac7be2d72a7f90f966 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-S=C3=A9bastien=20Caux?= <git@jscaux.org>
Date: Fri, 27 Jan 2023 14:45:02 +0100
Subject: [PATCH] Ensure mapping of `SubmissionAuthorProfile` FK when merging
 Profiles

---
 scipost_django/profiles/forms.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scipost_django/profiles/forms.py b/scipost_django/profiles/forms.py
index 0ada88598..4d30a9d7f 100644
--- a/scipost_django/profiles/forms.py
+++ b/scipost_django/profiles/forms.py
@@ -176,6 +176,9 @@ class ProfileMergeForm(forms.Form):
         # Move all affiliations to the "new" profile
         profile_old.affiliations.all().update(profile=profile)
 
+        # Move all SubmissionAuthorProfile instances to the "new" profile
+        profile_old.submissionauthorprofile_set.all().update(profile=profile)
+
         # Move all PublicationAuthorsTable instances to the "new" profile
         profile_old.publicationauthorstable_set.all().update(profile=profile)
 
-- 
GitLab