included ProjectForm in InternView. fixed DatePicker. use admin-css

This commit is contained in:
Benni Baermann 2020-10-21 11:15:55 +02:00
parent 8e0c48c354
commit e916a9a86b
3 changed files with 23 additions and 8 deletions

View file

@ -9,11 +9,11 @@ from .settings import DATAPROTECTION, FOERDERRICHTLINIEN
class ProjectForm(ModelForm): class ProjectForm(ModelForm):
start = DateField(widget=AdminDateWidget) start = DateField(widget=AdminDateWidget())
class Meta: class Meta:
model = Project model = Project
exclude = ('pid',) exclude = ('pid', 'granted', 'username', 'realname', 'email')
class VolunteerForm(ModelForm): class VolunteerForm(ModelForm):
@ -29,7 +29,7 @@ class VolunteerForm(ModelForm):
exclude = ('granted',) exclude = ('granted',)
INTERN_CHOICES = [('PRO', 'Projektsteckbrief'), INTERN_CHOICES = [('PRO', 'Projektsteckbrief'),
('HON', 'Eherenamtsbescheinigung'), ('HON', 'Ehrenamtsbescheinigung'),
('AKK', 'Akkreditierung oder Redaktionsbestätigung'), ('AKK', 'Akkreditierung oder Redaktionsbestätigung'),
('TRAV', 'Reisekostenerstattung')] ('TRAV', 'Reisekostenerstattung')]

View file

@ -1,3 +1,15 @@
{% load static %}
<script type="text/javascript" src="/admin/jsi18n/"></script>
<script type="text/javascript" src="{% static 'admin/js/core.js' %}"></script>
<script type="text/javascript" src="{% static 'admin/js/vendor/jquery/jquery.js' %}"></script>
<script type="text/javascript" src="{% static 'admin/js/jquery.init.js' %}"></script>
{{ form.media }}
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/base.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/widgets.css' %}" />
{% load i18n %} {% load i18n %}
{% block content %} {% block content %}
<p>Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}</p> <p>Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}</p>

View file

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