X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/SVBaL.git/blobdiff_plain/64f4159a8407164a0d03430f874124649d7a10fc..5a0935360261561cc0902f5aec5cb3d0ff8207e5:/python/eh_app/views.py diff --git a/python/eh_app/views.py b/python/eh_app/views.py index 2180df5..57ec14b 100644 --- a/python/eh_app/views.py +++ b/python/eh_app/views.py @@ -330,10 +330,10 @@ def ehmeldung(request, verein): # 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: @@ -341,10 +341,36 @@ def ehmeldung(request, verein): 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 @@ -388,14 +414,12 @@ def login(request): 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"