|
|
@ -8,15 +8,17 @@ from django.template.loader import get_template |
|
|
|
from django.template import Context |
|
|
|
# from django.contrib.sites.models import Site |
|
|
|
|
|
|
|
from .forms import ProjectForm, VolunteerForm, LibraryForm, IFGForm |
|
|
|
from .forms import ProjectForm, VolunteerForm, LibraryForm, IFGForm,\ |
|
|
|
HonoraryCertificateForm, InternForm |
|
|
|
from .models import Project, TYPE_CHOICES, Library |
|
|
|
from .settings import URLPREFIX, IF_EMAIL |
|
|
|
|
|
|
|
|
|
|
|
def authorize(request, choice, pk): |
|
|
|
'''If IF grant a support they click a link in a mail which leads here''' |
|
|
|
'''If IF grant a support they click a link in a mail which leads here. |
|
|
|
We write the granted field in the database here and set a timestamp.''' |
|
|
|
# TODO: write a timestamp which is needed to determine time of next mail |
|
|
|
|
|
|
|
|
|
|
|
if choice in ('BIB', 'ELIT', 'SOFT'): |
|
|
|
Library.set_granted(pk,True) |
|
|
|
return HttpResponse(f"AUTHORIZED! choice: {choice}, pk: {pk}") |
|
|
@ -25,7 +27,8 @@ def authorize(request, choice, pk): |
|
|
|
|
|
|
|
|
|
|
|
def deny(request, choice, pk): |
|
|
|
'''If IF denies a support they click a link in a mail which leads here''' |
|
|
|
'''If IF denies a support they click a link in a mail which leads here |
|
|
|
We write the granted field in the database here.''' |
|
|
|
|
|
|
|
if choice in ('BIB', 'ELIT', 'SOFT'): |
|
|
|
Library.set_granted(pk,False) |
|
|
@ -68,17 +71,18 @@ def done(request): |
|
|
|
def extern(request): |
|
|
|
return HttpResponse("The world out there is large and dangerous") |
|
|
|
|
|
|
|
class InternView(CookieWizardView): |
|
|
|
'''This View is for the WMDE-employees only''' |
|
|
|
|
|
|
|
template_name = 'input/extern.html' |
|
|
|
form_list = [InternForm, HonoraryCertificateForm] |
|
|
|
|
|
|
|
class ExternView(CookieWizardView): |
|
|
|
'''This View is for Volunteers''' |
|
|
|
|
|
|
|
template_name = "input/extern.html" |
|
|
|
form_list = [VolunteerForm, LibraryForm] |
|
|
|
|
|
|
|
# def process_step(self, form): |
|
|
|
# if form.cleaned_data.get('choice') == 'IFG': |
|
|
|
# print ('IFG detected!') |
|
|
|
# self.form_list = [VolunteerForm, IFGForm] |
|
|
|
# print('leaving process_step()') |
|
|
|
# return self.get_form_step_data(form) |
|
|
|
|
|
|
|
def get_form(self, step=None, data=None, files=None): |
|
|
|
if step is None: |
|
|
|
step = self.steps.current |
|
|
|