From 413bd043df90d22d38a01bc79b64d96e9dba5d3c Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Sat, 3 Nov 2018 21:47:51 +0000 Subject: [PATCH] models: Ensure UserProfile.user is configured Django Admin seems to be doing something funky with how it's handling the creation of a User's corresponding UserProfile instance when modelled as an inline field. Re-setting the UserProfile.user attribute seems to resolve the issue, so do just that. Signed-off-by: Stephen Finucane Closes: #110 (cherry picked from commit b1c2e80187008aff472c6509c67f44583cd3334c) --- patchwork/models.py | 1 + releasenotes/notes/issue-110-a5bb3184bf831280.yaml | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 releasenotes/notes/issue-110-a5bb3184bf831280.yaml diff --git a/patchwork/models.py b/patchwork/models.py index 6268f5b7..1a2de60a 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -212,6 +212,7 @@ class UserProfile(models.Model): def _user_saved_callback(sender, created, instance, **kwargs): try: profile = instance.profile + profile.user = instance except UserProfile.DoesNotExist: profile = UserProfile(user=instance) profile.save() diff --git a/releasenotes/notes/issue-110-a5bb3184bf831280.yaml b/releasenotes/notes/issue-110-a5bb3184bf831280.yaml new file mode 100644 index 00000000..16a0fa5f --- /dev/null +++ b/releasenotes/notes/issue-110-a5bb3184bf831280.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Assigning maintained projects when creating a new user in the admin page + was causing an error. This is now resolved. -- 2.47.3