diff --git a/shiftregister/feedback/__init__.py b/shiftregister/feedback/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/shiftregister/feedback/admin.py b/shiftregister/feedback/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/shiftregister/feedback/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/shiftregister/feedback/apps.py b/shiftregister/feedback/apps.py new file mode 100644 index 0000000..ffdf1c3 --- /dev/null +++ b/shiftregister/feedback/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class FeedbackConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "shiftregister.feedback" diff --git a/shiftregister/feedback/forms.py b/shiftregister/feedback/forms.py new file mode 100644 index 0000000..aaa3757 --- /dev/null +++ b/shiftregister/feedback/forms.py @@ -0,0 +1,20 @@ +from .models import Feedback +from django.forms import ModelForm +from django import forms + + +class FeedbackForm(ModelForm): + class Meta: + model = Feedback + fields = ("party", "next_year", "feedback_text") + labels = { + "party": "Kommst du zum HelferInnen Fest?", + "feedback_text": "Wie wars?", + "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?", + } + widgets = { + "party": forms.RadioSelect, + } diff --git a/shiftregister/feedback/migrations/0001_initial.py b/shiftregister/feedback/migrations/0001_initial.py new file mode 100644 index 0000000..052872a --- /dev/null +++ b/shiftregister/feedback/migrations/0001_initial.py @@ -0,0 +1,43 @@ +# Generated by Django 4.0.4 on 2023-05-25 14:16 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ("app", "0011_room_description"), + ] + + operations = [ + migrations.CreateModel( + name="Feedback", + fields=[ + ( + "helper", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + primary_key=True, + serialize=False, + to="app.helper", + ), + ), + ( + "party", + models.CharField( + choices=[ + ("yes", "ja"), + ("no", "nein"), + ("maybe", "vielleicht"), + ], + max_length=7, + ), + ), + ("next_year", models.BooleanField()), + ("feedback_text", models.TextField(blank=True, default="")), + ], + ), + ] diff --git a/shiftregister/feedback/migrations/__init__.py b/shiftregister/feedback/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/shiftregister/feedback/models.py b/shiftregister/feedback/models.py new file mode 100644 index 0000000..e575e1c --- /dev/null +++ b/shiftregister/feedback/models.py @@ -0,0 +1,19 @@ +from django.db import models +from shiftregister.app.models import Helper + + +class Feedback(models.Model): + helper = models.OneToOneField(Helper, primary_key=True, on_delete=models.CASCADE) + + class PartyState(models.TextChoices): + YES = "yes", "ja" + NO = "no", "nein" + MAYBE = "maybe", "vielleicht" + + 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 new file mode 100644 index 0000000..67491b7 --- /dev/null +++ b/shiftregister/feedback/templates/feedback.html @@ -0,0 +1,31 @@ + +{% extends "helper_base.html" %} + +{% block title %}Danke :){% endblock %} + +{% block content %} +
+{% endblock %} diff --git a/shiftregister/feedback/tests.py b/shiftregister/feedback/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/shiftregister/feedback/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/shiftregister/feedback/urls.py b/shiftregister/feedback/urls.py new file mode 100644 index 0000000..cf252c8 --- /dev/null +++ b/shiftregister/feedback/urls.py @@ -0,0 +1,11 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path( + "f/