Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using django-guest-user with allauth #14

Open
lchen198 opened this issue Jun 10, 2024 · 0 comments
Open

Using django-guest-user with allauth #14

lchen198 opened this issue Jun 10, 2024 · 0 comments

Comments

@lchen198
Copy link

lchen198 commented Jun 10, 2024

I recently discovered django-guest-user as an updated version of the django lazy user library. I'd love to see more documentation about integrating with allauth.

I have a customized signup form inherited from the allauth.account.forms.SignupForm and a customized User model.

My sign up form doesn't work with django-guest-user as it expects a UserCreationForm to convert a guest user to a real user.

The difference is that the allauth SignupForm's save function needs a request parameter that the django-guest-user view doesn't provide.

My solution is to create a new form and copy all the existing sign up fields over.

class GuestUserSignupForm(UserCreationForm):
    class Meta:
        model = User
        fields = ["username", "password1", "password2", ...]
    first_name = forms.CharField(max_length=30, label=_("First Name"))
    last_name = forms.CharField(max_length=30, label=_("Last Name"))
    #  other user signup fields ...

I wonder if there's better way to implement this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant