tttthomasssss
tttthomasssss

Reputation: 5971

Customising django-allauth's socialaccount signup form

I am successfully using my custom form class with the standard account signup, however I can't seem to be able to use a custom form class for the social account signup (the default signup form is always loaded).

As suggested in this question, I've set SOCIALACCOUNT_AUTO_SIGNUP = False. And as suggested in the django-allauth docs, I am using the following setting:

SOCIALACCOUNT_FORMS = {
    'signup': 'someapp.forms.SocialSignupForm'
}

The code for the custom form class looks something like this (so pretty much whats been suggested here):

class SocialSignupForm(forms.Form):
    foo = forms.CharField(max_length=255, label='Foo', widget=forms.TextInput(attrs={'placeholder': 'Bar'}))

    def signup(self, request, user):
        user.foo = self.cleaned_data['foo']
        user.save()

Upvotes: 1

Views: 573

Answers (1)

tttthomasssss
tttthomasssss

Reputation: 5971

To answer my own question, the problem was that the setting SOCIALACCOUNT_FORMS (and therefore the customisation of the Signup form) is only available from django-allauth 0.17.1 onwards.

My installed version is 0.17.0 (installed via pip), currently, 0.17.1 needs to be installed from source.

Upvotes: 1

Related Questions