[Django]-Django-crispy-forms AttributeError when using built in AuthenticationForm

7👍

It looks like you’ve got an error in your form:

class LoginForm(AuthenticationForm):
    def __init__(self, *args, **kwargs):
        super(LoginForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.layout = Layout(
            Field('username', placeholder="username"),
            Field('password', placeholder="password"),
        )

You are calling super, passing parent class AuthenticationForm not LoginForm.

Leave a comment