some preliminary work for authorize/deny links in mail

This commit is contained in:
Benni Bärmann 2020-10-20 08:06:36 +02:00
parent 1de0255582
commit c96f195b00
4 changed files with 20 additions and 10 deletions

View File

@ -21,7 +21,6 @@ class VolunteerForm(ModelForm):
class Meta: class Meta:
model = Volunteer model = Volunteer
fields = '__all__' fields = '__all__'
# labels = {'choice': 'Was möchtest Du beantragen?'}
class LibraryForm(ModelForm): class LibraryForm(ModelForm):

View File

@ -1,20 +1,20 @@
{{data}}
Hallo Team Ideenförderung, Hallo Team Ideenförderung,
es gab einen neuen Antrag von {{data.realname}}. es gab einen neuen Antrag von {{data.realname}}.
Username {{data.username}} fragt ein Der Nutzer mit dem Username {{data.username}} fragt ein {% if data.choice == 'LIT' %} Literaturstipendium
{% if data.choice == 'LIT' %} Literaturstipendium
{% elif data.choice == 'BIB' %} Bibliotheksstipendium {% elif data.choice == 'BIB' %} Bibliotheksstipendium
{% elif data.choice == 'IFG' %} IFG {% elif data.choice == 'IFG' %} IFG
{% elif data.choice == 'ELIT' %} eLiteraturstipendium {% elif data.choice == 'ELIT' %} eLiteraturstipendium
{% elif data.choice == 'SOFT' %} Softwarestipendium {% elif data.choice == 'SOFT' %} Softwarestipendium
{% elif data.choice == 'VIS' %} Visitenkarten, Mailingliste oder E-Mail-Adresse {% elif data.choice == 'VIS' %} Visitenkarten, Mailingliste oder E-Mail-Adresse
{% else %} ERROR UNKNOWN FORMTYPE {% else %} ERROR UNKNOWN FORMTYPE {% endif %} an.
{% endif %}
an.
Genehmigen: INSERT Link here Genehmigen: http://127.0.0.1:8000/authorize/{{data.id}}
Ablehnen: INSERT Link here Ablehnen: http://127.0.0.1:8000/deny/{{data.id}}
{% comment %} {% comment %}

View File

@ -1,6 +1,6 @@
from django.urls import path from django.urls import path
from .views import project, accreditation, travel, certificate, ExternView, done from .views import project, accreditation, travel, certificate, ExternView, done, authorize, deny
urlpatterns = [ urlpatterns = [
path('project', project, name='project'), path('project', project, name='project'),
@ -8,5 +8,7 @@ urlpatterns = [
path('travel', travel, name='travel'), path('travel', travel, name='travel'),
path('certificate', certificate, name='certificate'), path('certificate', certificate, name='certificate'),
path('extern', ExternView.as_view(), name='extern'), path('extern', ExternView.as_view(), name='extern'),
path('saved', done, name='done') path('saved', done, name='done'),
path('authorize/<int:pk>', authorize, name='authorize'),
path('deny/<int:pk>', deny, name='deny')
] ]

View File

@ -10,6 +10,12 @@ from django.template import Context
from .forms import ProjectForm, VolunteerForm, LibraryForm, IFGForm from .forms import ProjectForm, VolunteerForm, LibraryForm, IFGForm
from .models import Project, TYPE_CHOICES from .models import Project, TYPE_CHOICES
def authorize(request):
print('AUTHORIZE!')
def deny(request):
print('DENY!')
def project(request): def project(request):
# return HttpResponse("Hello, world. You're at the input form") # return HttpResponse("Hello, world. You're at the input form")
# ProjectFormSet = modelformset_factory(Project, fields='__all__') # ProjectFormSet = modelformset_factory(Project, fields='__all__')
@ -100,6 +106,9 @@ class ExternView(CookieWizardView):
form.type = data['choice'] form.type = data['choice']
form.save() form.save()
# add primary key to context
data['id'] = 100
# we need to send the following mails here: # we need to send the following mails here:
context = { 'data': data } context = { 'data': data }
try: try: