Open jantoniomartin opened 6 years ago
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).
pybb should be able to delegate profile creation to the main application
👍 agreed
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?