Thanks Melvyn!
On Thu, Aug 31, 2017 at 9:44 AM, Melvyn Sopacua <m.r.sopacua@gmail.com> wrote:
The answer lies in the fact that you are getting a Django configuration exception and not an ImportError.The solution: https://github.com/pennersr/django-allauth/ issues/826 So, there is an import loop / inheritance problem: Allauth's SignupForm makes itself a child of your custom form and you're trying to become it's child.--On Tue, Aug 29, 2017 at 5:13 AM, Alexander Joseph <alexander.v.joseph@gmail.com> wrote:--Hello, I'm trying to add some additional fields to the allauth signup form (first_name and last_name). I'm thinking the best way to do this is to create a allauth SignupForm subclass and add my own fields (very new to django so please let me know if I'm going about this wrong)I added
ACCOUNT_SIGNUP_FORM_CLASS = 'accounts.forms.UserCreateForm'
to my base settings fileand here is my accounts.forms.py...
from django.contrib.auth import get_user_modelfrom allauth.account.forms import SignupFormfrom django import formsclass UserCreateForm(SignupForm):class Meta:fields = ("first_name", "last_name", "email", "username", "password1", "password2")model = get_user_model()def __init__(self, *args, **kwargs):super().__init__(*args, **kwargs)self.fields["first_name"].label = '' self.fields["first_name"].widget.attrs["placeholder"] = "First Name" self.fields["last_name"].label = ''self.fields["last_name"].widget.attrs["placeholder"] = "Last Name" self.fields["email"].label = ''self.fields["email"].widget.attrs["placeholder"] = "Email" self.fields["username"].label = ''self.fields["username"].widget.attrs["placeholder"] = "Username" self.fields["password1"].label = ''self.fields["password1"].widget.attrs["placeholder"] = "Password" self.fields["password2"].label = ''self.fields["password2"].widget.attrs["placeholder"] = "Confirm Password" for some reason I keep getting the error ...
django.core.exceptions.ImproperlyConfigured: Error importing form class accounts.forms: "cannot import name 'SignupForm'"
Not sure why. Obviously there is a SignupForm in allauth.account.forms.py, seen here...I dont know what I'm doing wrong. Any help you can give is much appreciated
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com .
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ea79940e-0549 .-4ffa-802f-e72214d4ebe2%40goog legroups.com
For more options, visit https://groups.google.com/d/optout .
--Melvyn Sopacua
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/ .z4nArTYetUk/unsubscribe
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com .
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA% .2Bgw1GXd5rekiPZO-c%3DzPK0yyw_ L2XKTKv82n6uzrtgKTKK68g% 40mail.gmail.com
Best Regards,
Alexander Joseph
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGJrYjaDUqGyZGYbC2ppOrpg0sJgf7im24ihEdkFc8eqwwTF-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment