From: Michael Wagner Date: Thu, 1 Aug 2024 17:15:53 +0000 (+0200) Subject: pydev-s6git X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=d28a165e43ae970b392ff7b32613817c253b0ad7;p=SVBaL.git pydev-s6git --- diff --git a/debian/.dummy b/debian/.dummy new file mode 100644 index 0000000..e69de29 diff --git a/etc/eh_util.conf b/etc/eh_util.conf index b9909e2..81888e3 100644 --- a/etc/eh_util.conf +++ b/etc/eh_util.conf @@ -1,9 +1,8 @@ -# Configuration for mKrimi Verleihnix Gui - Alias /SVBaL "/usr/share/php/SVBaL/gui" - - Options +FollowSymlinks - RewriteEngine On - RewriteBase /SVBaL/ - RewriteRule ^.*php$ index.php - - +WSGIScriptAlias /eh-util /opt/eh_util/eh_util/wsgi.py +#WSGIPythonHome /path/to/venv +WSGIPythonPath /opt/eh_util + + +Require all granted + + diff --git a/python/eh_util/ausweis/AWK/.dummy b/python/eh_util/ausweis/AWK/.dummy new file mode 100644 index 0000000..e69de29 diff --git a/python/eh_util/ausweis/__init__.py b/python/eh_util/ausweis/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/python/eh_util/ausweis/admin.py b/python/eh_util/ausweis/admin.py new file mode 100644 index 0000000..d654f08 --- /dev/null +++ b/python/eh_util/ausweis/admin.py @@ -0,0 +1,9 @@ +from django.contrib import admin + +# Register your models here. + +from django.contrib import admin + +from .models import ConfigData + +admin.site.register(ConfigData) diff --git a/python/eh_util/ausweis/apps.py b/python/eh_util/ausweis/apps.py new file mode 100644 index 0000000..071f4d2 --- /dev/null +++ b/python/eh_util/ausweis/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class AusweisConfig(AppConfig): + name = 'ausweis' diff --git a/python/eh_util/ausweis/forms.py b/python/eh_util/ausweis/forms.py new file mode 100644 index 0000000..a16ef24 --- /dev/null +++ b/python/eh_util/ausweis/forms.py @@ -0,0 +1,17 @@ +from django import forms + +class UploadFileForm(forms.Form): + file1 = forms.FileField(label='S-Verein-Export') + +class DocumentForm(forms.Form): + docfile = forms.FileField( + label='Select a file', + help_text='max. 42 megabytes' + ) + +class TextInputForm(forms.Form): + text = forms.CharField( + label = "Text für das Anschreiben", + empty_value = "Bitte Text eingeben ...", + widget=forms.Textarea, + ) \ No newline at end of file diff --git a/python/eh_util/ausweis/migrations/.dummy b/python/eh_util/ausweis/migrations/.dummy new file mode 100644 index 0000000..e69de29 diff --git a/python/eh_util/ausweis/models.py b/python/eh_util/ausweis/models.py new file mode 100644 index 0000000..92cc381 --- /dev/null +++ b/python/eh_util/ausweis/models.py @@ -0,0 +1,12 @@ +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 diff --git a/python/eh_util/ausweis/templates/.dummy b/python/eh_util/ausweis/templates/.dummy new file mode 100644 index 0000000..e69de29 diff --git a/python/eh_util/ausweis/tests.py b/python/eh_util/ausweis/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/python/eh_util/ausweis/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/python/eh_util/ausweis/urls.py b/python/eh_util/ausweis/urls.py new file mode 100644 index 0000000..6567bea --- /dev/null +++ b/python/eh_util/ausweis/urls.py @@ -0,0 +1,11 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('', views.index, name='index'), + path('upload', views.upload), + path('anschreiben', views.anschreiben), + path('alle_ausweise', views.alle_ausweise), + path('einzelausweis', views.einzelausweis), +] \ No newline at end of file diff --git a/python/eh_util/ausweis/views.py b/python/eh_util/ausweis/views.py new file mode 100644 index 0000000..ba2b10c --- /dev/null +++ b/python/eh_util/ausweis/views.py @@ -0,0 +1,46 @@ +from .AWK import routines +from .forms import UploadFileForm, DocumentForm, TextInputForm + +from django.http import HttpResponse, HttpResponseRedirect +from django.shortcuts import render +from django.template import loader + + +def index(request, verein): + + # check existence in DB + csv_datei_name = routines.getCsvDateiName(verein) + if not csv_datei_name: + template = loader.get_template('index.html') + context = { + 'csv_datei_name': csv_datei_name, + } + return HttpResponse(template.render(context, request)) + return render(request, 'index.html', {'csv_datei_name': csv_datei_name}) + +def upload(request, verein): + if request.method == 'POST': + form = UploadFileForm(request.POST, request.FILES) + if form.is_valid(): + routines.handle_uploaded_file(verein, request.FILES['file1']) + return HttpResponseRedirect('') + return HttpResponse("Dateiverarbeitung fehlerhaft") + else: + form = UploadFileForm() + return render(request, 'upload.html', {'form': form}) + +def anschreiben(request, verein): + if request.method == 'POST': + form = TextInputForm(request.POST) + if form.is_valid(): + return HttpResponse("Dateiverarbeitung ok") + return HttpResponse("Dateiverarbeitung fehlerhaft") + else: + form = TextInputForm() + return render(request, 'anschreiben.html', {'form': form}) + +def alle_ausweise(request, verein): + return HttpResponse("NIY") + +def einzelausweis(request, verein): + return HttpResponse("NIY")