-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix UserMetadata
not being created if createsuperuser
script is used
#1113
Conversation
There seems to be a better way to do this without using signals - I'll close this and open a new PR |
5a9ad75
to
057d01b
Compare
I'm not sure what "better way" I was thinking about here, but this issue still occurs in dev environments. Unless I'm missing something, signals seems like the way to do this? |
I'm working on fixing the failing tests. |
70ac7bf
to
a3cfb11
Compare
After testing this locally, it doesn't seem the |
Oh, maybe that was why I closed this before 😄 |
Can we do something super dumb, like include another management command to run after |
a3cfb11
to
eda502b
Compare
6bf3886
to
d4542b6
Compare
I attempted to fix this with 6b5b6e4, but it's throwing some error during tests. I think ultimately this is something we need to fix upstream in composed-configuration. |
d4542b6
to
3cb1a97
Compare
3cb1a97
to
749c467
Compare
🚀 PR was released in |
Before, we were listening to theallauth.user_signed_up
signed up signal to create the UserMetadata. Howver, this doesn't work if theUser
is created outside ofdjango-allauth
(like whenmanage.py createsuperuser
is used), so this changes it to use the more generalUser
post_save signal.Updated approach: Before, we were listening to theallauth.user_signed_up
signed up signal to create the UserMetadata. This doesn't work if theUser
is created with thecreatesuperuser
management command, as composed-configuration overrides that to create a user of typeEmailAsUsernameProxyUser
(which is a subclass ofUser
). See kitware-resonant/django-composed-configuration#187 for more info.(Another) updated approach: the previous approach didn't work either, so I just overrode the
createsuperuser
script to manually create theUserMetadata
record after it runs. I used Django signals to do this, as there's no way to get the new user's info from theCommand
object.Fixes #1085