1
0
Fork 0

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

This commit is contained in:
Benni Bärmann 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):
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')]

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 %}
{% block content %}
<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)
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