I am trying to override the default django-allauth
templates and use django-crispy-forms
from improved rendering but having no luck getting the forms to actually submit, meaning I press submit and nothing happens.
Here is my settings.py
:
INSTALLED_APPS = [
'about.apps.AboutConfig',
'content.apps.ContentConfig',
'users.apps.UsersConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
]
...
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
# All Auth settings
AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
)
SITE_ID = 1
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = 'email'
Here is my custom template:
{% extends "about/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
{% block navbar %}{% endblock %}
<div class="site-section mb-5">
<div class="container">
<div class="form-register">
<form method="POST" class="signup" id="signup_form" action="{% url 'account_signup' %}">
{% csrf_token %}
<legend>Signup</legend>
<div class="form-group">
{{ form | crispy }}
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="Sign Up">
</div>
</form>
</div>
</div>
</div>
{% endblock %}
I know the template is in the correct location and correctly overriding the django-allauth
default templates because it renders, but why won't the submit button submit the form? I also know everything with django-allauth
is working, because if I remove the custom template and use the django-allauth
template, it will submit the form and redirect properly.