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 <stephen@that.guru>
Closes: #110
(cherry picked from commit
b1c2e80187008aff472c6509c67f44583cd3334c)
def _user_saved_callback(sender, created, instance, **kwargs):
try:
profile = instance.profile
+ profile.user = instance
except UserProfile.DoesNotExist:
profile = UserProfile(user=instance)
profile.save()
--- /dev/null
+---
+fixes:
+ - |
+ Assigning maintained projects when creating a new user in the admin page
+ was causing an error. This is now resolved.