feat: make regirstration form nicer

This commit is contained in:
moanos [he/him] 2024-08-03 09:40:53 +02:00
parent 4358d37f37
commit d7cf051a16
3 changed files with 15 additions and 11 deletions

View File

@ -145,6 +145,14 @@ class CustomRegistrationForm(RegistrationForm):
class Meta(RegistrationForm.Meta):
model = User
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_id = 'form-registration'
self.helper.form_class = 'card'
self.helper.add_input(Submit('submit', _('Registrieren'), css_class="btn"))
def _get_distances():
return {i: i for i in [10, 20, 50, 100, 200, 500]}

View File

@ -453,7 +453,7 @@ select, .button {
padding: 5px;
}
#form-adoption-notice {
#form-adoption-notice, #form-registration {
.form-group {
margin: 30px;
}

View File

@ -1,15 +1,11 @@
{% extends "fellchensammlung/base_generic.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block content %}
{% if not user.is_authenticated %}
<form method="post" action=".">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% translate 'Registrieren' %}" />
</form>
{% else %}
<p>{% translate "Du bist bereits eingeloggt." %}</p>
{% endif %}
{% if not user.is_authenticated %}
{% crispy form %}
{% else %}
<p>{% translate "Du bist bereits eingeloggt." %}</p>
{% endif %}
{% endblock %}