]> wagnertech.de Git - SVBaL.git/commitdiff
pydev-s6
authorMichael Wagner <michael@wagnertech.de>
Thu, 27 Feb 2025 20:21:18 +0000 (21:21 +0100)
committerMichael Wagner <michael@wagnertech.de>
Thu, 27 Feb 2025 20:21:18 +0000 (21:21 +0100)
python/eh_util/eh_app/AWK/routines.py
python/eh_util/eh_app/templates/kassenbrief.html
python/eh_util/eh_app/views.py
python/eh_util/eh_util/settings.py

index 52509b70106b2b726c41078058e54a93801af969..c60832830e1c364e12e8a4d96ad5ed5f8ab93927 100644 (file)
@@ -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"])
index e275490d40949acaeb9a085251ec4752359bef8c..f1d906bd1ecbcb345d4f1070b803a8ba5ed76a8a 100644 (file)
@@ -5,7 +5,7 @@
 <body>
 <h1>Erstellung Kassenbrief</h1>
 <p>Überprüfen Sie folgende Eingabedaten</p>
-<form action="/{{verein}}/kassenbrief/" method="post">
+<form action="/{{verein}}/kassenbrief/" method="post" enctype="multipart/form-data">
 {% csrf_token %}
 <table>
 <tr><th>Briefpapier:</th><td>{{briefpapier}}</td></tr>
index f3da238cdd2a66699408bff5398e62517ddef1dd..7e56b681a08bf9ae6a7d8f5c5b94c18cb264b1fa 100644 (file)
@@ -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:
index 0517206a20140e21455460496df94a6047a96a88..1264b3cef16f50749adc82d595cc9b1c3bcd3ffd 100644 (file)
@@ -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',
     }
 }