From e916a9a86be1240c666ad3cbfc5eb3fec24401a5 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 21 Oct 2020 11:15:55 +0200 Subject: [PATCH] included ProjectForm in InternView. fixed DatePicker. use admin-css --- input/forms.py | 6 +++--- input/templates/input/extern.html | 12 ++++++++++++ input/views.py | 13 ++++++++----- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/input/forms.py b/input/forms.py index 0e6f3fb..f692a25 100644 --- a/input/forms.py +++ b/input/forms.py @@ -9,11 +9,11 @@ from .settings import DATAPROTECTION, FOERDERRICHTLINIEN class ProjectForm(ModelForm): - start = DateField(widget=AdminDateWidget) + start = DateField(widget=AdminDateWidget()) class Meta: model = Project - exclude = ('pid',) + exclude = ('pid', 'granted', 'username', 'realname', 'email') class VolunteerForm(ModelForm): @@ -29,7 +29,7 @@ class VolunteerForm(ModelForm): exclude = ('granted',) INTERN_CHOICES = [('PRO', 'Projektsteckbrief'), - ('HON', 'Eherenamtsbescheinigung'), + ('HON', 'Ehrenamtsbescheinigung'), ('AKK', 'Akkreditierung oder Redaktionsbestätigung'), ('TRAV', 'Reisekostenerstattung')] diff --git a/input/templates/input/extern.html b/input/templates/input/extern.html index 71ca7d0..5b26e80 100644 --- a/input/templates/input/extern.html +++ b/input/templates/input/extern.html @@ -1,3 +1,15 @@ +{% load static %} + + + + + + +{{ form.media }} + + + + {% load i18n %} {% block content %}

Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}

diff --git a/input/views.py b/input/views.py index 567cda6..d34ecd3 100644 --- a/input/views.py +++ b/input/views.py @@ -23,7 +23,7 @@ def authorize(request, choice, pk): Library.set_granted(pk,True) return HttpResponse(f"AUTHORIZED! choice: {choice}, pk: {pk}") else: - return HttpResponse('ERROR! UNKNWON CHOICE TYPE!') + return HttpResponse(f'ERROR! UNKNWON CHOICE TYPE! {choice}') def deny(request, choice, pk): @@ -34,7 +34,7 @@ def deny(request, choice, pk): Library.set_granted(pk,False) return HttpResponse(f"DENIED! choice: {choice}, pk: {pk}") else: - return HttpResponse('ERROR! UNKNWON CHOICE TYPE!') + return HttpResponse(f'ERROR! UNKNWON CHOICE TYPE {choice}!') # def project(request): @@ -60,7 +60,7 @@ def done(request): return HttpResponse("Your data is save now.") class InternView(CookieWizardView): - '''This View is for the WMDE-employees only''' + '''This View is for WMDE-employees only''' template_name = 'input/extern.html' form_list = [InternForm, ProjectForm] @@ -76,8 +76,11 @@ class InternView(CookieWizardView): if choice == 'HON': print ('Ehrenamtsbescheinigung detected!') form = HonoraryCertificateForm(data) + elif choice == 'PRO': + print ('Projektsteckbrief erreicht!') + form = ProjectForm(data) else: - raise RuntimeError('ERROR! UNKNOWN FORMTYPE!') + raise RuntimeError(f'ERROR! UNKNOWN FORMTYPE {choice}') else: form = super().get_form(step, data, files) return form @@ -128,7 +131,7 @@ class ExternView(CookieWizardView): form = LibraryForm(data) form.fields['library'].label = v else: - raise RuntimeError('ERROR! UNKNOWN FORMTYPE!') + raise RuntimeError(f'ERROR! UNKNOWN FORMTYPE {choice}') else: form = super().get_form(step, data, files) return form