Beispiel #1
0
    def save(self, profile_callback=None):
        """
        This method is overrided from the registrationForm in django-registration.
        It Create the new ``User`` and ``RegistrationProfile``, and
        returns the ``User``.

        This is essentially a light wrapper around
        ``RegistrationProfile.objects.create_inactive_user()``,
        feeding it the form data and a profile callback (see the
        documentation on ``create_inactive_user()`` for details) if
        supplied.

        """
        new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['email'],
                                                                    password=self.cleaned_data['password1'],
                                                                    email=self.cleaned_data['email'],
                                                                    profile_callback=profile_callback)
        shop = Shop()
        shop.name = self.cleaned_data['store_name']
        shop.owner = new_user
        shop.save()
        return new_user