Skip to content

user_saved signal handler tries to create profile, causing an IntegrityError #286

@jantoniomartin

Description

@jantoniomartin

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions