From 3adaba94b851cb73455a5f806b5303ebb664740c Mon Sep 17 00:00:00 2001 From: ben8 Date: Mon, 17 Feb 2025 18:10:22 +0100 Subject: [PATCH] Besser aussehendes Register-Form und answer.html richtig eingebunden --- .gitignore | 2 +- core/accounts/forms.py | 16 ++++- core/accounts/templates/accounts/login.html | 11 ++++ .../accounts/templates/accounts/register.html | 60 +++++++++++++++---- .../templates/components/answer.html | 15 ++--- .../components/templates/components/base.html | 1 + core/components/urls.py | 2 +- core/components/views.py | 4 +- core/core/settings.py | 1 + core/homepage/static/homepage/t-input.css | 3 +- core/homepage/static/homepage/t-style.css | 2 +- 11 files changed, 92 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index cd6601b..dca8225 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ __pycache__ .venv db.sqlite3 -tailwindcss-windows-x64.exe \ No newline at end of file +tailwindcss.exe \ No newline at end of file diff --git a/core/accounts/forms.py b/core/accounts/forms.py index fb0527e..6da316b 100644 --- a/core/accounts/forms.py +++ b/core/accounts/forms.py @@ -1,8 +1,22 @@ from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User +from django import forms class RegisterForm(UserCreationForm): class Meta: model=User - fields = ['username','password1','password2'] \ No newline at end of file + fields = ['username','password1','password2'] + + username = forms.CharField( + widget=forms.TextInput(attrs={'placeholder': 'BENUTZERNAME'}) + ) + password1 = forms.CharField( + widget=forms.PasswordInput(attrs={'placeholder': 'PASSWORT'}) + ) + password2 = forms.CharField( + widget=forms.PasswordInput(attrs={'placeholder': 'PASSWORT WIEDERHOLEN'}) + ) + + + diff --git a/core/accounts/templates/accounts/login.html b/core/accounts/templates/accounts/login.html index 884b151..2167670 100644 --- a/core/accounts/templates/accounts/login.html +++ b/core/accounts/templates/accounts/login.html @@ -6,6 +6,17 @@

Anmeldung

+ {% if form.errors %} +
+
    + {% for field, errors in form.errors.items %} + {% for error in errors %} +
  • {{ error }}
  • + {% endfor %} + {% endfor %} +
+
+ {% endif %} {% csrf_token %}
diff --git a/core/accounts/templates/accounts/register.html b/core/accounts/templates/accounts/register.html index f1e6997..795701c 100644 --- a/core/accounts/templates/accounts/register.html +++ b/core/accounts/templates/accounts/register.html @@ -1,14 +1,52 @@ {% extends 'accounts/base.html' %} {% block title %}Registrierung{% endblock %} {% block content %} -
-

Registrierung

-
-