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): class Meta(RegistrationForm.Meta):
model = User 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(): def _get_distances():
return {i: i for i in [10, 20, 50, 100, 200, 500]} return {i: i for i in [10, 20, 50, 100, 200, 500]}

View File

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

View File

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