Django-allauth: ACCOUNT_SIGNUP_FORM_CLASS, django.core.exceptions.ImproperlyConfigured: Module "" does not define a "" class

Created on 29 May 2017  路  3Comments  路  Source: pennersr/django-allauth

Hi guys! Can someone help me to figure out what am I doing wrong?

I have profiles.forms.ExtraDataSignupForm:

from django import forms


class ExtraDataSignupForm(forms.Form):
    country = forms.CharField(required=False)
    about = forms.CharField(required=False)

NB I know about required signup method, I'm not defining it to catch an exception about it.

In my settings.py I have:

ACCOUNT_SIGNUP_FORM_CLASS = 'profiles.forms.ExtraDataSignupForm'

And on running project I'm getting django.core.exceptions.ImproperlyConfigured:

django.core.exceptions.ImproperlyConfigured: Module "profiles.forms" does not define a "ExtraDataSignupForm" class

If I comment ACCOUNT_SIGNUP_FORM_CLASS in settings and try from shell:

In [1]: from importlib import import_module

In [2]: f = import_module('profiles.forms')

In [3]: c = getattr(f, 'ExtraDataSignupForm')

In [4]: c
Out[4]: profiles.forms.ExtraDataSignupForm

Everything importing fine without errors.

What am I doing wrong? Could anyone help me?

Thanks!

UPDATE

Seems the problem is because I have also inherited from SignupForm and other custom forms for login, password reset and others.

Most helpful comment

So, for those who would suffer with the same issue:

The issue occurs if you have customized SignupForm with ACCOUNT_FORMS and extended the signup form with ACCOUNT_SIGNUP_FORM_CLASS. Make sure your custom SignupForm and your form for extension defined in different files.

In my case, I had them in the one file profiles.forms and there was a cycling import (I guess). I've moved my ExtraDataSignupForm to separate file and point to in in ACCOUNT_SIGNUP_FORM_CLASS, everything works like a charm.

Good luck!

All 3 comments

BTW is there a way to implement ACCOUNT_FORMS and ACCOUNT_SIGNUP_FORM_CLASS in the same time?

So, for those who would suffer with the same issue:

The issue occurs if you have customized SignupForm with ACCOUNT_FORMS and extended the signup form with ACCOUNT_SIGNUP_FORM_CLASS. Make sure your custom SignupForm and your form for extension defined in different files.

In my case, I had them in the one file profiles.forms and there was a cycling import (I guess). I've moved my ExtraDataSignupForm to separate file and point to in in ACCOUNT_SIGNUP_FORM_CLASS, everything works like a charm.

Good luck!

I have no clue of what you did. For me it's not working. I know it's been a while but do you remember what you did?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

psychok7 picture psychok7  路  5Comments

aliabbas-2012 picture aliabbas-2012  路  6Comments

lukeburden picture lukeburden  路  5Comments

nordbit picture nordbit  路  5Comments

blueyed picture blueyed  路  5Comments