From: Michael Wagner Date: Thu, 27 Feb 2025 20:21:18 +0000 (+0100) Subject: pydev-s6 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/SVBaL.git/commitdiff_plain/e42cf897044959225e07226a5486c5f86ad93d3d pydev-s6 --- diff --git a/python/eh_util/eh_app/AWK/routines.py b/python/eh_util/eh_app/AWK/routines.py index 52509b7..c608328 100644 --- a/python/eh_util/eh_app/AWK/routines.py +++ b/python/eh_util/eh_app/AWK/routines.py @@ -8,15 +8,16 @@ def handle_uploaded_file(csv_file): for chunk in csv_file.chunks(): destination.write(chunk) ''' -def aktualisiere_config(config, data): - if data["briefpapier"]: - uploaded_file = data["briefpapier"] +def aktualisiere_config(config, data, file): + + if file: + uploaded_file = file.name data_path = config.requireConfig("data_path") # copy briefpapier into data_path - with open(os.path.join(data_path, uploaded_file.name), 'wb+') as destination: - for chunk in uploaded_file.chunks(): + with open(os.path.join(data_path, uploaded_file), 'wb+') as destination: + for chunk in file.chunks(): destination.write(chunk) - config.setConfig("briefpapier", uploaded_file.name) + config.setConfig("briefpapier", uploaded_file) if data["basisbeitrag"]: config.setConfig("beitrag_basis", data["basisbeitrag"]) diff --git a/python/eh_util/eh_app/templates/kassenbrief.html b/python/eh_util/eh_app/templates/kassenbrief.html index e275490..f1d906b 100644 --- a/python/eh_util/eh_app/templates/kassenbrief.html +++ b/python/eh_util/eh_app/templates/kassenbrief.html @@ -5,7 +5,7 @@

Erstellung Kassenbrief

Überprüfen Sie folgende Eingabedaten

-
+ {% csrf_token %} diff --git a/python/eh_util/eh_app/views.py b/python/eh_util/eh_app/views.py index f3da238..7e56b68 100644 --- a/python/eh_util/eh_app/views.py +++ b/python/eh_util/eh_app/views.py @@ -48,12 +48,15 @@ def kassenbrief(request, verein): # check whether it's valid: if form.is_valid(): # bei Änderungen Konfiguration aktualisieren - routines.aktualisiere_config(vconf, form.cleaned_data) + routines.aktualisiere_config(vconf, form.cleaned_data, request.FILES.get('briefpapier_neu', None)) #Stammdaten neu aus Datenbank lesen und prüfen briefpapier = vconf.getConfig("briefpapier") beitrag_basis = int(vconf.getConfig("beitrag_basis", 0)) beitrag_zusatz = int(vconf.getConfig("beitrag_zusatz", 0)) + briefpapier_label = briefpapier + if not briefpapier: + briefpapier_label = "Kein Briefpapier ausgewäht" # prüfen ob Werte gefüllt if briefpapier is None: diff --git a/python/eh_util/eh_util/settings.py b/python/eh_util/eh_util/settings.py index 0517206..1264b3c 100644 --- a/python/eh_util/eh_util/settings.py +++ b/python/eh_util/eh_util/settings.py @@ -79,7 +79,7 @@ WSGI_APPLICATION = 'eh_util.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'NAME': '/var/django/eh_util.sqlite3', } }
Briefpapier:{{briefpapier}}