Browse Source

broken version, still working on authentification

master
Benni Baermann 4 years ago
parent
commit
fa41a93325
2 changed files with 7 additions and 3 deletions
  1. +1
    -0
      foerderbarometer/urls.py
  2. +6
    -3
      input/views.py

+ 1
- 0
foerderbarometer/urls.py View File

@ -19,4 +19,5 @@ from django.urls import path, include
urlpatterns = [ urlpatterns = [
path('', include("input.urls")), path('', include("input.urls")),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('accounts/', include('django.contrib.auth.urls')),
] ]

+ 6
- 3
input/views.py View File

@ -8,6 +8,8 @@ from django.core.mail import send_mail, BadHeaderError
from django.conf import settings from django.conf import settings
from django.template.loader import get_template from django.template.loader import get_template
from django.template import Context from django.template import Context
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from .forms import ProjectForm, ExternForm, LibraryForm, IFGForm, LiteratureForm,\ from .forms import ProjectForm, ExternForm, LibraryForm, IFGForm, LiteratureForm,\
HonoraryCertificateForm, InternForm, TravelForm, EmailForm,\ HonoraryCertificateForm, InternForm, TravelForm, EmailForm,\
@ -27,7 +29,7 @@ def auth_deny(choice,pk,auth):
return HttpResponse(f'ERROR! UNKNWON CHOICE TYPE! {choice}') return HttpResponse(f'ERROR! UNKNWON CHOICE TYPE! {choice}')
return False return False
@login_required
def authorize(request, choice, pk): 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.''' We write the granted field in the database here and set a timestamp.'''
@ -38,7 +40,7 @@ def authorize(request, choice, pk):
else: else:
return HttpResponse(f"AUTHORIZED! choice: {choice}, pk: {pk}") return HttpResponse(f"AUTHORIZED! choice: {choice}, pk: {pk}")
@login_required
def deny(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.''' We write the granted field in the database here.'''
@ -53,7 +55,8 @@ def deny(request, choice, pk):
def done(request): def done(request):
return HttpResponse("Your data is save now.") return HttpResponse("Your data is save now.")
class InternView(CookieWizardView):
class InternView(LoginRequiredMixin, CookieWizardView):
'''This View is for WMDE-employees only''' '''This View is for WMDE-employees only'''
template_name = 'input/extern.html' template_name = 'input/extern.html'

Loading…
Cancel
Save