dimanche 31 août 2014

Overriding Django allauth login form with ACCOUNT_FORMS


Vote count:

0




I already overrode the signup form with the simple settings variable ACCOUNT_SIGNUP_FORM_CLASS but to override the login form you need to use ACCOUNT_FORMS = {'login': 'yourapp.forms.LoginForm'}. I have the form I want and it displys perfectly with crispy-forms:



class LoginForm(forms.Form):
login = forms.EmailField(required = True)
password = forms.CharField(widget = forms.PasswordInput, required = True)

helper = FormHelper()
helper.form_show_labels = False
helper.layout = Layout(
Field('login', placeholder = 'Email address'),
Field('password', placeholder = 'Password'),
FormActions(
Submit('submit', 'Log me in to Cornell Forum', css_class = 'btn-primary')
),
)


When I submit the form I get AttributeError at /account/login/ - 'LoginForm' object has no attribute 'login'. What's going wrong here? The source for the original allauth login form is here: http://ift.tt/1u5Pplv



asked 25 secs ago

wnajar

414






Overriding Django allauth login form with ACCOUNT_FORMS

Aucun commentaire:

Enregistrer un commentaire