From 542970b768f3cb05025e704e38fbd6e6758b88e0 Mon Sep 17 00:00:00 2001 From: Tyler Mees Date: Thu, 25 Apr 2024 17:34:47 +0200 Subject: [PATCH] fix: ensure faculty is saved on user create --- main/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/models.py b/main/models.py index 3663e4550..6af5c198a 100644 --- a/main/models.py +++ b/main/models.py @@ -162,6 +162,9 @@ def process_faculties(self, faculties): if faculty_obj.users.filter(pk=self.pk).exists(): continue + # Save the user to ensure the user is saved before adding the faculty + self.save() + faculty_obj.users.add(self) except: # noQA logger.error(f"Error processing faculty for user", exc_info=True)