For the sake of consistency I want to use crispy with my login form.
I'm using 'django.contrib.auth.views.login'
and I'm only coding the template.
The problem is {% crispy form %}
doesn’t output submit button nor "next" hidden field.
Is there any way to create FormHelper
outside of forms.py
( it's in contrib.auth so I would need to try to extend AuthenticationForm
or something like it) an then use it in the template without modifying views.py
(also in contrib.auth)
If it would require any ninjitsu with extending classes etc. I will go with pure HTML but if there is a simple way to include 'external' FormHelper
on the template level i would regret not asking
I'm not sure why do you need to use {% crispy form %}
and not just the crispy
filter. I'm using crispy in my login form, overriding the template from django.contrib.auth, this way:
{% load crispy_forms_tags %}
{% block body %}
<form method="post" action="" class="form-signin">{% csrf_token %}
{{ form|crispy }}
<div>
<button type="submit" class="btn btn-primary">{% trans "Log in" %}</button>
</div>
</form>
{% endblock %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With