Answer the question
In order to leave comments, you need to log in
How to use allauth forms in your views?
I use allauth to register and authenticate users. I use django-bootstrap3 for styling. I want to use allauth forms in my views. Login form on the main page domain.com/
. I do it like this.
views.py
from allauth.account.forms import LoginForm
def home(request):
context = {
'login_form': LoginForm
}
return render(request, 'home.html', context)
...
<form class="login" method="POST" action="{% url 'account_login' %}">
{% csrf_token %}
{% bootstrap_form login_form label='horizontal' %}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<button type="submit" class="btn btn-primary">{% trans "Sign In" %}</button>
<a class="button secondaryAction" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
</form>
...
domain.com/accounts/login/
. And I can't figure out where to override this redirect. Tell me please. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question