# check whether it's valid:
if form.is_valid():
# bei Änderungen Konfiguration aktualisieren
- routines.erstelle_ehmeldung(form.cleaned_data)
- routines.erstelle_ausweis(form.cleaned_data)
+ routines.erstelle_ehmeldung(form.cleaned_data, verein)
+ routines.erstelle_ausweis(form.cleaned_data, verein)
# redirect to a new URL:
- return HttpResponseRedirect('/thanks/')
+ return HttpResponseRedirect(f'/eh-app/{verein}/ehmeldung/erfolg')
# if a GET (or any other method) we'll create a blank form
else:
return render(request, 'ehmeldung.html', {'form': form, 'verein': verein})
+@login_required(login_url=LOGIN_URL)
+def ehmeldung_erfolg(request, verein):
+ return render(request, 'ehmeldung_erfolg.html', {
+ 'verein' : verein,
+ })
+
+@login_required(login_url=LOGIN_URL)
+def ehmeldung_download(request, verein):
+ vconf = config.getInstance(verein)
+ data_path = vconf.requireConfig("data_path")
+
+ ergebnis_datei = os.path.join(data_path, "build", "meldung.pdf")
+
+ response = FileResponse(open(ergebnis_datei, 'rb'), as_attachment=True, filename="meldung.pdf")
+ return response
+
+@login_required(login_url=LOGIN_URL)
+def ausweis_download(request, verein):
+ vconf = config.getInstance(verein)
+ data_path = vconf.requireConfig("data_path")
+
+ ergebnis_datei = os.path.join(data_path, "build", "ausweis.pdf")
+
+ response = FileResponse(open(ergebnis_datei, 'rb'), as_attachment=True, filename="ausweis.pdf")
+ return response
+
@login_required(login_url=LOGIN_URL)
def vertragsliste(request, verein):
vconf = config.getInstance(verein)
- data_path = vconf.getConfig("data_path", "/var/ehapp")
+ data_path = vconf.requireConfig("data_path")
ergebnis_datei = routines.vertragsliste_erstellen(verein, data_path)
response = FileResponse(open(os.path.join(data_path, "build",ergebnis_datei), 'rb'), as_attachment=True, filename=ergebnis_datei)
return response
if group.name == verein:
auth.login(request, user)
if request.user.is_authenticated:
- print("auth login ok")
- else:
- print("auth not logged in")
- next = request.POST.get("next", None)
- if next:
- return HttpResponseRedirect(next)
- else:
- return HttpResponseRedirect(f'/eh-app/{verein}')
+ auth.login(request, user)
+ next = request.POST.get("next", None)
+ if next:
+ return HttpResponseRedirect(next)
+ else:
+ return HttpResponseRedirect(f'/eh-app/{verein}')
# login fehlgeschlagen
fehlertext = "Login fehlgeschlagen"