Add reusable form template snippet

This commit is contained in:
Tobias Kunze 2025-03-18 05:08:43 +01:00
parent 0be7c6fb6f
commit 325e767b0e
2 changed files with 17 additions and 5 deletions

View file

@ -41,11 +41,9 @@
id="login-form"
class="form form-vertical"
style="max-width: 400px">
<form method="post" action="{% url 'account_login' %}">
{% csrf_token %}
{{ form }}
<button class="btn btn-primary" type="submit">{% translate "Sign In" %}</button>
</form>
{% url 'account_login' as form_action %}
{% translate "Sign In" as form_submit_label %}
{% include "includes/form.html" %}
</div>
</div>
</div>

View file

@ -0,0 +1,14 @@
{% load i18n %}
<form class="form form-vertical"
method="post"
{% if form_action %}action="{{ form_action }}"{% endif %}>
{% csrf_token %}
{{ form }}
<button class="btn btn-primary" type="submit">
{% if form_submit_label %}
{{ form_submit_label }}
{% else %}
{% translate "Save" %}
{% endif %}
</button>
</form>