[Answered ]-Create additional model on activation django-registration

2👍

There are lot’s of different ways in which this task can be achieved the most django like method would be to rely on a signal. More specifically the user_registered signal.

registration.signals.user_registered Sent when a new user account is
registered. Provides the following arguments:

sender The RegistrationView subclass used to register the account.
user A user-model instance representing the new account.
request The
HttpRequest in which the new account was registered.

def create_user_profile(sender, user, requet):
    '''
    Creates a profile object for registered users via the
    user_registered signal
    '''

    obj = UserProfile.objects.get_or_create(user=user)

An alternative is to subclass the RegistrationView. A second alternative is to catch the post_save signal on User.

👤e4c5

Leave a comment