From efe0d392db1f24b6d6c1b5e5e12bf33691a505ae Mon Sep 17 00:00:00 2001 From: "Andreas (@xAndy) Zimmermann" Date: Tue, 17 May 2022 16:26:31 +0200 Subject: [PATCH] add first asta functionality --- shiftregister/app/forms.py | 8 +++++ .../migrations/0009_helper_asta_confirmed.py | 18 +++++++++++ shiftregister/app/models.py | 1 + shiftregister/app/templates/asta.html | 31 +++++++++++++++++++ shiftregister/app/templates/helper_base.html | 13 ++++++++ shiftregister/app/urls.py | 1 + shiftregister/app/views.py | 21 ++++++++++++- 7 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 shiftregister/app/migrations/0009_helper_asta_confirmed.py create mode 100644 shiftregister/app/templates/asta.html diff --git a/shiftregister/app/forms.py b/shiftregister/app/forms.py index 3b9b0a1..7f81b0c 100644 --- a/shiftregister/app/forms.py +++ b/shiftregister/app/forms.py @@ -39,6 +39,14 @@ class RegisterForm(forms.Form): okf = forms.BooleanField(label="Ich bin damit einverstanden, SMS zu erhalten.") +class AstaForm(forms.Form): + confirm = forms.BooleanField( + required=True, + label="Ich habe mich beim AStA als reguläres Mitglied angemeldet", + help_text="Aus Versicherungsgründen müssen Helfer*innen AStA Mitglieder sein. Die Mitgliedschaft ist kostenlos.", + ) + + # placeholder form for simple submit button use cases so we get csrf protection class EmptyForm(forms.Form): pass diff --git a/shiftregister/app/migrations/0009_helper_asta_confirmed.py b/shiftregister/app/migrations/0009_helper_asta_confirmed.py new file mode 100644 index 0000000..f50931d --- /dev/null +++ b/shiftregister/app/migrations/0009_helper_asta_confirmed.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.4 on 2022-05-17 13:13 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("app", "0008_alter_message_sent_at"), + ] + + operations = [ + migrations.AddField( + model_name="helper", + name="asta_confirmed", + field=models.BooleanField(default=False), + ), + ] diff --git a/shiftregister/app/models.py b/shiftregister/app/models.py index f78cd5c..d1c9c3a 100644 --- a/shiftregister/app/models.py +++ b/shiftregister/app/models.py @@ -67,6 +67,7 @@ class Helper(models.Model): name = models.CharField(max_length=200) # change this to a generic state variable to allow for number blocking/account deactivation? number_validated = models.BooleanField(default=False) + asta_confirmed = models.BooleanField(default=False) def __str__(self): return self.name diff --git a/shiftregister/app/templates/asta.html b/shiftregister/app/templates/asta.html new file mode 100644 index 0000000..950e86a --- /dev/null +++ b/shiftregister/app/templates/asta.html @@ -0,0 +1,31 @@ +{% extends "helper_base.html" %} + +{% block title %}Registrierung{% endblock %} + +{% block content %} +AStA Formular +
+ {% csrf_token %} +{% for field in form %} +
+{% if field.widget_type == 'checkbox' %} +
+ +
+{% else %} + +
+ {{ field }} +
+{% endif %} +{% for error in field.errors %} +

{{ error }}

+{% endfor %} +{% if field.help_text %} +

{{ field.help_text }}

+{% endif %} +
+{% endfor %} + +
+{% endblock %} diff --git a/shiftregister/app/templates/helper_base.html b/shiftregister/app/templates/helper_base.html index eacaf1c..a089c9c 100644 --- a/shiftregister/app/templates/helper_base.html +++ b/shiftregister/app/templates/helper_base.html @@ -2,6 +2,10 @@ {% block title %}Help!{% endblock %} +{% block custom_notifications %} + +{% endblock %} + {% block navbar %}