From 092f0643268fbfa8b51f36347ae02e2c2e2d68e0 Mon Sep 17 00:00:00 2001 From: mhewel <58829786+mhewel@users.noreply.github.com> Date: Mon, 25 Nov 2024 20:11:05 +0100 Subject: [PATCH] =?UTF-8?q?Oprettelse=20af=20frivillig=20foresp=C3=B8rgsel?= =?UTF-8?q?=20uden=20login?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2 fejl: Listen med afdelinger er både m checkboxe (korrekt), og radiobuttons (forkerte) Besked om success vises også efter login --- members/forms/__init__.py | 6 +- members/forms/volunteer_request_form.py | 103 ++++++++++++ members/forms/volunteer_request_new_form.py | 156 ------------------ .../migrations/0061_merge_20241125_1626.py | 13 ++ members/templates/members/header.html | 2 +- .../templates/members/volunteer_request.html | 24 ++- .../members/volunteer_request_created.html | 7 + members/urls.py | 13 +- members/views/VolunteerRequest.py | 42 +++++ members/views/VolunteerRequestNew.py | 79 --------- members/views/__init__.py | 2 +- 11 files changed, 196 insertions(+), 251 deletions(-) create mode 100644 members/forms/volunteer_request_form.py delete mode 100644 members/forms/volunteer_request_new_form.py create mode 100644 members/migrations/0061_merge_20241125_1626.py create mode 100644 members/templates/members/volunteer_request_created.html create mode 100644 members/views/VolunteerRequest.py delete mode 100644 members/views/VolunteerRequestNew.py diff --git a/members/forms/__init__.py b/members/forms/__init__.py index be92b7cb..30017b7f 100644 --- a/members/forms/__init__.py +++ b/members/forms/__init__.py @@ -1,7 +1,7 @@ from .person_form import PersonForm from .signup_form import signupForm from .volunteer_signup_form import vol_signupForm -from .volunteer_request_new_form import volunteerRequestNewForm +from .volunteer_request_form import VolunteerRequestForm from .admin_signup_form import adminSignupForm from .activity_signup_form import ActivitySignupForm from .activity_invite_decline_form import ActivivtyInviteDeclineForm @@ -13,7 +13,5 @@ signupForm, vol_signupForm, adminSignupForm, - volunteerRequestNewForm, - volunteer_request_new_form, - + VolunteerRequestForm, ] diff --git a/members/forms/volunteer_request_form.py b/members/forms/volunteer_request_form.py new file mode 100644 index 00000000..ee103ab2 --- /dev/null +++ b/members/forms/volunteer_request_form.py @@ -0,0 +1,103 @@ +from django import forms +from crispy_forms.helper import FormHelper +from crispy_forms.layout import Layout, Fieldset, Hidden, Div, Field, Submit + +from members.models.volunteerrequest import VolunteerRequest + +from members.models.department import Department + +from django.forms.widgets import CheckboxSelectMultiple +from django.utils.html import format_html + + +class CustomCheckboxSelectMultiple(CheckboxSelectMultiple): + def render(self, name, value, attrs=None, choices=()): + output = [] + for option in self.choices: + obj = option[1] + address = f"{obj.name} (" + if obj.address.descriptiontext: + address += f"{obj.address.descriptiontext} " + if obj.address.streetname: + address += f"{obj.address.streetname} " + if obj.address.housenumber: + address += f"{obj.address.housenumber}, " + if obj.address.zipcode: + address += f"{obj.address.zipcode} " + if obj.address.city: + address += f"{obj.address.city}" + address += ")" + output.append( + format_html( + '', + name, + option[0], + address, + ) + ) + return format_html("
Hvis du har børn der er tilmeldt i systemet og allerede er oprettet som familie, så log blot på jeres familie side med den email du opskrev dig med, da du tilmeldte dig. Her kan du også tilføje flere personer, hvis det f.eks. er din partner der har tilmeldt børnene men du nu selv vil være med som frivillig.
+Hvis du har børn der er tilmeldt i systemet og allerede er oprettet som familie,
+ så log blot på jeres familie side med den email du opskrev dig med, da du tilmeldte dig
+ Her kan du også tilføje flere personer, hvis det f.eks. er din partner der har tilmeldt børnene men du nu selv vil være med som frivillig.
Denne formular er tænkt til frivillige, der ikke har børn der er medlemmer i Coding Pirates.
Your volunteer request has been submitted successfully!
+