templates: use with_template template tag to render forms (#40159)
This commit is contained in:
parent
7c2c6db430
commit
a0eeaede8d
|
@ -1,5 +1,5 @@
|
|||
{% extends "authentic2/base-page.html" %}
|
||||
{% load i18n %}
|
||||
{% load i18n gadjo %}
|
||||
|
||||
{% block page-title %}
|
||||
{{ block.super }} - {{ view.title }}
|
||||
|
@ -14,9 +14,9 @@
|
|||
{% block content %}
|
||||
<p>{% blocktrans with email=user.email %}Your current email is {{ email }}.
|
||||
An email will be sent to validate the new one.{% endblocktrans %}</p>
|
||||
<form method="post">
|
||||
<form method="post" class="pk-mark-optional-fields">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form|with_template }}
|
||||
<button class="submit-button">{% trans "Validate" %}</button>
|
||||
<button class="cancel-button" name="cancel" formnovalidate>{% trans "Cancel" %}</button>
|
||||
</form>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{% load i18n staticfiles %}
|
||||
{% load i18n staticfiles gadjo %}
|
||||
|
||||
{% block login %}
|
||||
|
||||
{% block form %}
|
||||
<div>
|
||||
<form method="post">
|
||||
<form method="post" class="pk-mark-optional-fields">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form|with_template }}
|
||||
{% block buttons %}
|
||||
<button class="submit-button" name="{{ submit_name }}">{% trans "Log in" %}</button>
|
||||
{% if cancel %}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% load i18n %}
|
||||
{% load i18n gadjo %}
|
||||
|
||||
{% block registration %}
|
||||
<form enctype="multipart/form-data" method="post">
|
||||
<form enctype="multipart/form-data" method="post" class="pk-mark-optional-fields">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form|with_template }}
|
||||
<button class="submit-button">{% trans 'Submit' %}</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "authentic2/base-page.html" %}
|
||||
{% load i18n %}
|
||||
{% load i18n gadjo %}
|
||||
|
||||
{% block page-title %}
|
||||
{{ block.super }} - {{ view.title }}
|
||||
|
@ -12,7 +12,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post" action=".">
|
||||
<form method="post" action="." class="pk-mark-optional-fields">
|
||||
{% if user.has_usable_password %}
|
||||
<p>{% blocktrans %}To change your password you must provide your current password, then provide
|
||||
the new password and confirm it.
|
||||
|
@ -21,7 +21,7 @@
|
|||
<p>{% blocktrans %}You are going to define your account password.{% endblocktrans %}</p>
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form|with_template }}
|
||||
<button class="submit-button">{% trans 'Submit' %}</button>
|
||||
<button class="cancel-button" name="cancel" formnovalidate>{% trans "Cancel" %}</button>
|
||||
</form>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "authentic2/base-page.html" %}
|
||||
{% load i18n %}
|
||||
{% load i18n gadjo %}
|
||||
|
||||
{% block title %}
|
||||
{{ view.title }}
|
||||
|
@ -9,9 +9,9 @@
|
|||
|
||||
{% if validlink %}
|
||||
|
||||
<form method="post">
|
||||
<form method="post" class="pk-mark-optional-fields">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form|with_template }}
|
||||
|
||||
<button class="submit-button">{% trans 'Submit' %}</button>
|
||||
</form>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "authentic2/base-page.html" %}
|
||||
{% load i18n %}
|
||||
{% load i18n gadjo %}
|
||||
|
||||
{% block title %}
|
||||
{% trans "Resetting password" %}
|
||||
|
@ -9,9 +9,9 @@
|
|||
|
||||
<h2>{% trans "Resetting password" %}</h2>
|
||||
|
||||
<form method="post">
|
||||
<form method="post" class="pk-mark-optional-fields">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form|with_template }}
|
||||
|
||||
<button class="submit-button">{% trans 'Submit' %}</button>
|
||||
</form>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "authentic2/base-page.html" %}
|
||||
{% load i18n %}
|
||||
{% load i18n gadjo %}
|
||||
|
||||
{% block title %}
|
||||
{% trans "Registration" %}
|
||||
|
@ -10,10 +10,10 @@
|
|||
<h2>{% trans "Registration" %}</h2>
|
||||
<p>{% trans "Please fill the form to complete your registration" %}</p>
|
||||
{% endblock %}
|
||||
<form method="post" class="a2-registration-completion-form">
|
||||
<form method="post" class="a2-registration-completion-form pk-mark-optional-fields">
|
||||
{% block registration-completion-form-top %}{% endblock %}
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form|with_template }}
|
||||
<button class="submit-button">{% trans 'Submit' %}</button>
|
||||
{% block registration-completion-form-bottom %}{% endblock %}
|
||||
{% csrf_token %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "authentic2_auth_fc/base.html"%}
|
||||
{% load staticfiles %}
|
||||
{% load i18n %}
|
||||
{% load i18n gadjo %}
|
||||
|
||||
{% block content %}
|
||||
<p>
|
||||
|
@ -26,7 +26,7 @@
|
|||
{% endif %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form|with_template }}
|
||||
<button class="submit-button" name="unlink">{% trans "Unlink" %}</button>
|
||||
<button class="cancel-button" name="cancel" formnovalidate>{% trans "Cancel" %}</button>
|
||||
</form>
|
||||
|
|
|
@ -879,7 +879,7 @@ def test_ou_selector(slapd, settings, app, ou1):
|
|||
response.form.set('password', PASS)
|
||||
response.form.set('ou', str(get_default_ou().pk))
|
||||
response = response.form.submit(name='login-password-submit')
|
||||
assert response.pyquery('.errorlist.nonfield')
|
||||
assert response.pyquery('.errornotice')
|
||||
assert '_auth_user_id' not in app.session
|
||||
|
||||
# Check login to the proper ou works
|
||||
|
@ -907,7 +907,7 @@ def test_ou_selector_default_ou(slapd, settings, app, ou1):
|
|||
response.form.set('password', PASS)
|
||||
response.form.set('ou', str(ou1.pk))
|
||||
response = response.form.submit(name='login-password-submit')
|
||||
assert response.pyquery('.errorlist.nonfield')
|
||||
assert response.pyquery('.errornotice')
|
||||
assert '_auth_user_id' not in app.session
|
||||
|
||||
# Check login to the proper ou works
|
||||
|
|
|
@ -174,13 +174,12 @@ def test_ou_selector(app, settings, simple_user, ou1, ou2, user_ou1, role_ou1):
|
|||
response.form.set('username', simple_user.username)
|
||||
response.form.set('password', simple_user.username)
|
||||
response = response.form.submit(name='login-password-submit')
|
||||
assert response.pyquery('.errorlist')
|
||||
assert response.pyquery('.widget-with-error')
|
||||
# Check login to the wrong ou do not work
|
||||
response.form.set('password', simple_user.username)
|
||||
response.form.set('ou', str(ou1.pk))
|
||||
response = response.form.submit(name='login-password-submit')
|
||||
assert not response.pyquery('.errorlist:not(.nonfield)')
|
||||
assert response.pyquery('.errorlist.nonfield')
|
||||
assert response.pyquery('.errornotice')
|
||||
assert '_auth_user_id' not in app.session
|
||||
# Check login to the proper ou works
|
||||
response.form.set('password', simple_user.username)
|
||||
|
|
|
@ -201,7 +201,7 @@ def test_username_settings(app, db, settings, mailoutbox):
|
|||
assert response.pyquery('[for=id_%s]' % key)
|
||||
assert response.pyquery('[for=id_%s]' % key).attr('class') == 'form-field-required'
|
||||
|
||||
assert response.pyquery('#id_username').next('.helptext').text() == 'Bien remplir'
|
||||
assert response.pyquery('#id_username').next('.hint').text() == 'Bien remplir'
|
||||
assert not response.pyquery('.errorlist')
|
||||
|
||||
# check username is validated using regexp
|
||||
|
|
Loading…
Reference in New Issue