You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an application with a CustomProfile class which has a OneToOne relationship to Django's User model. When a new user is created, a create_profile function handles the post_save signal from the User model and creates the CustomProfile object.
In my settings I have set PYBB_PROFILE_RELATED_NAME=CustomProfile. Because of this setting, when a new user is created, the user_saved function in pybbm's signals.py tries to create a CustomProfile too, triggering an Integrity error, since the profile was already created by my own app.
If I'm not wrong, PYBB_PROFILE_RELATED_NAME is used for more thing than just creating the profile after signup. Therefore I would suggest a new setting in pybbm to enable or disable this profile creation. Something like PYBB_CREATE_PROFILE_AFTER_SIGNUP=True|False. What do you think? Should I try it and make a pull request?
The text was updated successfully, but these errors were encountered:
Maybe you could use pre_save signal on your CustomProfile to set your specific data and let pybb create the CustomProfile instance via it's user_saved function ?
My handler just creates the CustomProfile, which pybb also does, so I have modified my handler to do nothing if pybb is installed.
Nonetheless it doesn't look too elegant to me (though it solves the problem). I think that if the custom profile is part of an application, which pybb is not a fundamental part of, pybb should be able to delegate profile creation to the main application (just my opinion, of course).
I have an application with a
CustomProfile
class which has a OneToOne relationship to Django'sUser
model. When a new user is created, acreate_profile
function handles thepost_save
signal from theUser
model and creates theCustomProfile
object.In my settings I have set
PYBB_PROFILE_RELATED_NAME=CustomProfile
. Because of this setting, when a new user is created, theuser_saved
function in pybbm's signals.py tries to create aCustomProfile
too, triggering an Integrity error, since the profile was already created by my own app.If I'm not wrong,
PYBB_PROFILE_RELATED_NAME
is used for more thing than just creating the profile after signup. Therefore I would suggest a new setting in pybbm to enable or disable this profile creation. Something likePYBB_CREATE_PROFILE_AFTER_SIGNUP=True|False
. What do you think? Should I try it and make a pull request?The text was updated successfully, but these errors were encountered: