--- /dev/null
+svbal (0.1-%BUILD%) unstable; urgency=medium
+ * initial version: Ausweiserstellung
+ -- Michael Wagner <info@wagnertech.de> Sat, 06 Jun 2020 20:03:04 +0100
+
--- /dev/null
+compile_type=NONE
+target_type=DEB
--- /dev/null
+Source: svbal
+Section: main
+Priority: optional
+Maintainer: Michael Wagner <michael@wagnertech.de>
+Build-Depends: git, mbuild
+
+Package: eigenheimer-util
+Architecture: all
+Depends: texlive-latex-base, texlive-latex-recommended, texlive-lang-german, python3, apache2, libapache2-mod-wsgi-py3
+Description: Mitgliederverwaltung Eigenheimerverband
+ .
+
--- /dev/null
+#!/bin/bash
+set -e
+
+mkdir -p $1/opt
+cp -r python/eh_util $1/opt
+
+# DB löschen
+rm $1/opt/eh_util/db.sqlite3
+
+mkdir -p $1/etc/apache2/sites-available/
+cp etc/eh_util.conf $1/etc/apache2/sites-available/
+
--- /dev/null
+#!/bin/bash
+set -e
+
+# DB anlegen/migrieren
+/opt/eh_util/manage.py migrate
+
+# activate verleihnix configuration
+if ! test -e /etc/apache2/sites-enabled/eh_util.conf
+then
+ a2ensite eh_util
+ systemctl reload apache2
+ echo "eh_util configration enabled"
+fi
--- /dev/null
+'''
+Created on 02.08.2024
+
+@author: sparky2021
+'''
+from ausweis.models import ConfigData
+
+the_instance = None
+
+class Config:
+ '''
+ Singleton Klasse für Konfiguration
+ '''
+
+ def __init__(self, verein):
+ self.verein = verein
+
+ def getConfig(self, key):
+ data = ConfigData.objects.filter(verein=self.verein, key=key)
+ if data:
+ return data[0].value
+ return None
+
+ def requireConfig(self, key):
+ data = self.getConfig(key)
+ if not data:
+ raise RuntimeError(f"Kein Eintag für: {self.verein}/{key}")
+ return data
+
+
+def getInstance(verein=None):
+ global the_instance
+ if not the_instance:
+ if not verein:
+ raise RuntimeError("Bei der ersten Instanzierung muss der Verein mitgegeben werden.")
+ the_instance = Config(verein)
+ return the_instance
--- /dev/null
+from ausweis.AWK import config
+
+import os
+
+def handle_uploaded_file(csv_file):
+ csv_file_name = str(csv_file)
+ data_path = config.getInstance().requireConfig("data_path")
+ path = os.path.join(data_path, csv_file_name)
+ with open(path, 'wb+') as destination:
+ for chunk in csv_file.chunks():
+ destination.write(chunk)
+
\ No newline at end of file
--- /dev/null
+# Generated by Django 2.2.28 on 2024-08-02 07:38
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='ConfigData',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('verein', models.CharField(max_length=100)),
+ ('key', models.CharField(max_length=50)),
+ ('value', models.CharField(max_length=200)),
+ ],
+ ),
+ ]
from django.db import models
-class ConfigData(models.Model):
- verein = models.CharField(max_length=100)
- datei = models.CharField(max_length=200)
- data_path = models.CharField(max_length=200)
-
"""
Falls hier Änderungen gemacht werden:
- ./manage.py makemigrations ausweis
- ./manage.py migrate
-"""
\ No newline at end of file
+"""
+
+class ConfigData(models.Model):
+ verein = models.CharField(max_length=100)
+ key = models.CharField(max_length=50)
+ value = models.CharField(max_length=200)
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>WagnerTech - Siedlerverein</title>
+</head>
+
+<body>
+<h1>Anschreiben für den Ausweis</h1>
+<form action="anschreiben" method="post" enctype="multipart/form-data">
+{% csrf_token %}
+<p>{{ form.text.label_tag }} {{ form.text }}</p>
+
+ <p><input type="submit" value="Anschreiben erstellen"/></p>
+</form>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+ <title>Siedlerverein-Verwaltung by WagnerTech UG</title>
+</head>
+<body>
+<h1>Erstellung Mitgliederausweise</h1>
+{% if csv_datei_name %}
+ <p>S-Verein-Export: {{csv_datei_name}}</p>
+ <p><a href="upload">Datei ändern</a></p>
+{% else %}
+ <p><a href="upload">Datei hochladen</a></p>
+{% endif %}
+<p><a href="anschreiben">Anschreiben erstellen</a></p>
+<p><a href="alle_ausweise">Alle Ausweise erstellen</a></p>
+<p><a href="einzelausweis">Einzelnen Ausweis erstellen</a></p>
+</body>
+</html>
-from .AWK import routines
+from .AWK import routines, config
from .forms import UploadFileForm, DocumentForm, TextInputForm
from django.http import HttpResponse, HttpResponseRedirect
def index(request, verein):
# check existence in DB
- csv_datei_name = routines.getCsvDateiName(verein)
+ vconf = config.getInstance(verein)
+ csv_datei_name = vconf.getConfig("csv_datei_name")
if not csv_datei_name:
template = loader.get_template('index.html')
context = {
def upload(request, verein):
if request.method == 'POST':
+ # initialize configuration
+ config.getInstance(verein)
form = UploadFileForm(request.POST, request.FILES)
if form.is_valid():
- routines.handle_uploaded_file(verein, request.FILES['file1'])
- return HttpResponseRedirect('')
+ routines.handle_uploaded_file(request.FILES['file1'])
+ return HttpResponseRedirect(f'/{verein}/ausweis')
return HttpResponse("Dateiverarbeitung fehlerhaft")
else:
form = UploadFileForm()