From 03307f82651c9fd1a821a0e16faed4e56ad02114 Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 25 May 2023 18:53:26 +0200 Subject: [PATCH] Update infos and add data retention note --- .../0006_fallbackassignment_was_full.py | 1 - shiftregister/feedback/forms.py | 8 +++--- .../feedback/migrations/0001_initial.py | 1 - shiftregister/feedback/models.py | 1 - .../feedback/templates/feedback.html | 27 ++++++++++++++----- shiftregister/feedback/views.py | 13 ++++----- 6 files changed, 30 insertions(+), 21 deletions(-) diff --git a/shiftregister/fallback/migrations/0006_fallbackassignment_was_full.py b/shiftregister/fallback/migrations/0006_fallbackassignment_was_full.py index 2be44e4..6c81924 100644 --- a/shiftregister/fallback/migrations/0006_fallbackassignment_was_full.py +++ b/shiftregister/fallback/migrations/0006_fallbackassignment_was_full.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("fallback", "0005_alter_teammember_id"), ] diff --git a/shiftregister/feedback/forms.py b/shiftregister/feedback/forms.py index aaa3757..2cdfa25 100644 --- a/shiftregister/feedback/forms.py +++ b/shiftregister/feedback/forms.py @@ -8,13 +8,15 @@ class FeedbackForm(ModelForm): model = Feedback fields = ("party", "next_year", "feedback_text") labels = { - "party": "Kommst du zum HelferInnen Fest?", - "feedback_text": "Wie wars?", + "party": "Kommst du zum Helfer*innen-Fest?", + "feedback_text": "Wie war's?", "next_year": "Dürfen wir dich nächstes Jahr wieder kontaktieren?", } help_texts = { - "feedback_text": "Was hat dir gefallen? Was hat geklappt? Was können wir naechstes Jahr besser machen?", + "feedback_text": "Was hat dir gefallen? Was hat geklappt? Was können wir nächstes Jahr besser machen?", + "next_year": "Hiermit bestätigst du, dass wir deinen Namen und deine Telefonnummer für bis zu ein Jahr nach Abgabe deiner Einwilligung speichern dürfen.", } widgets = { + "feedback_text": forms.Textarea(attrs={"class": "textarea"}), "party": forms.RadioSelect, } diff --git a/shiftregister/feedback/migrations/0001_initial.py b/shiftregister/feedback/migrations/0001_initial.py index 052872a..c489ba0 100644 --- a/shiftregister/feedback/migrations/0001_initial.py +++ b/shiftregister/feedback/migrations/0001_initial.py @@ -5,7 +5,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/shiftregister/feedback/models.py b/shiftregister/feedback/models.py index e575e1c..a3af1a0 100644 --- a/shiftregister/feedback/models.py +++ b/shiftregister/feedback/models.py @@ -13,7 +13,6 @@ class Feedback(models.Model): party = models.CharField( max_length=7, choices=PartyState.choices, - blank=False, ) next_year = models.BooleanField() feedback_text = models.TextField(blank=True, default="") diff --git a/shiftregister/feedback/templates/feedback.html b/shiftregister/feedback/templates/feedback.html index 7107c8e..28c936e 100644 --- a/shiftregister/feedback/templates/feedback.html +++ b/shiftregister/feedback/templates/feedback.html @@ -1,16 +1,20 @@ - {% extends "helper_base.html" %} {% block title %}Danke :){% endblock %} {% block content %} -Randdaten:
- +
+

Randdaten zum Helfer*innen-Fest

+ +

+
+ Bitte teil uns hierüber mit, ob du kommst. Vergiss nicht, deine Angaben mit dem Speichern-Button unten abzuschicken. +
{% csrf_token %} {% for field in form %} @@ -19,6 +23,15 @@ Randdaten:
+{% elif field.widget_type == 'radioselect' %} + +
+{% for radio in field %} +{% if radio.choice_label|cut:"-" != "" %} + +{% endif %} +{% endfor %} +
{% else %}
diff --git a/shiftregister/feedback/views.py b/shiftregister/feedback/views.py index 8058ddb..73a47fe 100644 --- a/shiftregister/feedback/views.py +++ b/shiftregister/feedback/views.py @@ -7,7 +7,11 @@ from django.contrib import messages def feedback(request, token): tk = get_object_or_404(LoginToken, pk=token) + request.session["token"] = token + helper = tk.helper + request.helper = helper + form = FeedbackForm() prev_data = Feedback.objects.filter(helper=helper).first() if prev_data: @@ -24,11 +28,4 @@ def feedback(request, token): "Deine Angaben wurden gespeichert.", ) - return render( - request, - "feedback.html", - { - "form": form, - "helper": helper, - }, - ) + return render(request, "feedback.html", {"form": form})