From 06fc10a5c64d62050514d58d1f55cbe2cebf5977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rnR?= Date: Thu, 27 Oct 2022 22:31:41 +0200 Subject: [PATCH] erste fassung komplett --- .gitignore | 1 + app.py | 38 ++++++++++++-- registrierung.db | 0 static/CCLOGO-vect.svg | 107 ++++++++++++++++++++++++++++++++++++++++ static/favicon.ico | Bin 0 -> 16958 bytes templates/base.html | 51 +++++++++++++++++++ templates/index.html | 75 ++++++++++++++++++++++++++++ templates/register.html | 44 +++++++++++++++++ 8 files changed, 312 insertions(+), 4 deletions(-) create mode 100644 registrierung.db create mode 100644 static/CCLOGO-vect.svg create mode 100644 static/favicon.ico create mode 100644 templates/base.html create mode 100644 templates/index.html create mode 100644 templates/register.html diff --git a/.gitignore b/.gitignore index 00a4441..4bf2d16 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ app.cpython-310.pyc energiemon.db +gtVi.py diff --git a/app.py b/app.py index 6f12638..f155204 100644 --- a/app.py +++ b/app.py @@ -1,8 +1,38 @@ -from flask import Flask +import sqlite3 +from flask import Flask, render_template, request, url_for, flash, redirect +from werkzeug.exceptions import abort + +def get_db_connection(): + conn = sqlite3.connect('energiemon.db') + conn.row_factory = sqlite3.Row + return conn app = Flask(__name__) +app.config['SECRET_KEY'] = 'Voobaiyae*h7kigj' + +@app.route('/', methods=('GET', 'POST')) +def index(): + + + if request.method == 'POST': + gaszaehler = request.form['gaszaehler'] + stromzaehler = request.form['stromzaehler'] + wasserzaehler = request.form['wasserzaehler'] + wetter = "weteter" + conn = get_db_connection() + conn.execute("INSERT INTO eintraege ( gaszaehler, stromzaehler, wasserzaehler, wetterinfo) VALUES ( ?, ?, ?, ?)", + (gaszaehler , stromzaehler, wasserzaehler, wetter ) + ) + conn.commit() + conn.close() + flash('Vielen Dank G' + gaszaehler + ' S' + stromzaehler + ' W' + wasserzaehler,'success') + return redirect(url_for('index')) -@app.route('/') -def hello(): - return 'Hello, World!' + conn = get_db_connection() + eintraege = conn.execute('SELECT * FROM eintraege').fetchall() + conn.close() + return render_template('index.html', eintraege=eintraege ) + +if __name__ == '__main__': + app.run() \ No newline at end of file diff --git a/registrierung.db b/registrierung.db new file mode 100644 index 0000000..e69de29 diff --git a/static/CCLOGO-vect.svg b/static/CCLOGO-vect.svg new file mode 100644 index 0000000..3cc997a --- /dev/null +++ b/static/CCLOGO-vect.svg @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..39a26597267c91dd9787a69686ffbd0f26f03ef1 GIT binary patch literal 16958 zcmeHOdvH|M8NYD{wiP=Wtzd`j?p;7fD(zHTo2u;)v7PY`q|@3??H@X*19s}zLU|}i zJG*u=Q(GF_L9%z3Bv5%6VW^K$3=CniuLNQelxj$0BW!KunLtbeSz&iif8WjSx;cC9 z&ECyT*reRdFW-55=R4o;yzaT@-j$>x{M~!6g#S)y?tPLpLz1Mq0Fop(KKAKuzgS$u$dcFfbRX`^Y z2bcj2LieyE=q-2nE2o?4+ZY;?14=Rceg+`UF~A6CE#1qoLu2FtDd8SN@AEh9412DF zf6oH{1+;jWk=~9maZmo9np`p-m%w)s@WB}K&TPAjsB4oWtlVTW8$;%7L52Ff0-(8? z>EC#TX^!1*$Z3<5QSV$JkRxxJzx#ltz;_)1?<_}1DVFzFPrWrd+O%5H(X;9wGqvrzHbBn$iY9%Rb>e{T|c5xPT?!T4O4KxER};w z4Q!0Gj(!H6@;Qyl6wZw4QF~DNCh9r{X!T7W@?ORob-yj>yVeW`>>4oe}bg(y%2p@BE@2QrX)Gw{Zdl@45X+H{zJBOjTp#; ztp&gZL0#1E+hxDcre)3%YA%OP5v>wvEK;$!}^#ioedmfl?55K7S41l@t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AtOK~zPv6r5YHV~b6i0U#W&HK?omEX#h ztFri0JG8d8X7O*toYA-sX1_c%*a+ZH=e@MAHih3vcJ4X&H`aGK$|@=MsFWa+c z4{K{{V*>*NY3gy7U`KmTvL_F}%5$gn{xLm1`Q+j3WD4vq1j2yUyIS6tyyJ7jo7BBs zWZ)c&ClYDi3GhCHXMp{<=Re-Mi?>hr>?#S*{rParr3}W^ZK#9Z)#maI1Mi>V_(QEb z*_N&*_S(nq0Y})@j}EaF@4dlpMf<>qOwhaIU4WbmkJ0Ej!rp19=cm9vK=dvw)35Oe zQ@_{ZoJaU=)@Zoul|_9esP_rrZJ-Yr53YP2G~cUnuXgD9I@WnOKlw7&2)a+a1B}<+ z8SA{VSnnH?vF0tZFE`V7dY+%-_dq`Qw;!Ny=Z*vPj-1Y<`93rnr}g&``n*(Be<7#A zXIi6-^3Bwz@2y<;-gjCd^VITf6#QwO-HqQ;(9b(3?3D+9y05(oShh zr^*@hUD0*j?6%Y4PiuJ)SdVX@zh-v5g<=o<>H8TU=JE6B->2~V$@w!IHf4QhQYijj z^<(n3K>DF79Y{#UYB(YlsnRV;E(8*20~s;~X@%^Cv_M86B}jh}f-c6~R;ZLQM#?~f z!tP>7g#5)URuq-25i5&YB9f)o!lG8cBt + + + + + + + + + + {% block title %} {% endblock %} + + + +
+{% with errors = get_flashed_messages(category_filter=["error"]) %} +{% if errors %} +
+
    + {%- for msg in errors %} +
    {{ msg }} + {% endfor -%} +
+
+{% endif %} +{% endwith %} +{% with successmsgs = get_flashed_messages(category_filter=["success"]) %} +{% if successmsgs %} +
+
    + {%- for msg in successmsgs %} +
    {{ msg }} + {% endfor -%} +
+
+{% endif %} +{% endwith %} + + {% block content %} {% endblock %} +
+ + + + + + + \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..a43aa70 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,75 @@ +{% extends 'base.html' %} + +{% block content %} +

{% block title %} EnergieMonitor {% endblock %}

+

Erfassung

+ +
+
+ App statt Zettel! +
+ Hier gibt es etwas zu erfassen.... +
+
+ Chamäleon Logo +
+ +
+
+ + +
+ + + +
+ + + +
+
+ +
+ +
+
+

Infos / Datenschutz

+

+ Diese Erfassung läuft bei uns im Serverraum.
+ Die hier aufgenommenen Daten werden vertraulich und lediglich für die Auswertung von + Verbräuchen verwendet. + + Bei Fragen zur Datenhaltung und zum Datenschutz wenden Sie sich gern
+ an: kontakt @ ChamäleonCloud +

+ + + + + + + + + + + +{% endblock %} diff --git a/templates/register.html b/templates/register.html new file mode 100644 index 0000000..60a2966 --- /dev/null +++ b/templates/register.html @@ -0,0 +1,44 @@ +{% extends 'base.html' %} + +{% block content %} +

{% block title %} Registrierung {% endblock %}

+

Registrierung

+ + +

Infos / Datenschutz

+

+ Diese Registrierung läuft lokal bei uns im Haus.
+ Die hier aufgenommenen Daten werden vertraulich und lediglich für die ggf. nötige, + hilfreiche Nachverfolgung von Infektionsketten im Zusammenhang mit der Corona-Pandemie aufgenommen, + maximal vier Wochen gesichert im Hause aufbewahrt und nur auf Anfrage an das zuständige Gesundheitsamt weitergegeben. +
+ Verpflichtende Angaben sind: +

    +
  • Datum, Zeit (Wird automatisch erfasst)
  • +
  • Vorname, Name
  • +
  • Eine Angabe von
  • +
      +
    • Telefonnummer oder
    • +
    • E-Mail Adresse oder
    • +
    • Anschrift (Straße Hausnummer, PLZ Ort
    • +
    +
+ Bei Fragen zur Datenhaltung und zum Datenschutz wenden Sie sich gern
+ an: [E-Mail] moin @ Gut Moorbeck +

+ +{# +

Gäste bisher:

+

+ {% for gast in guests %} + +

{{ gast['nachname'] }}

+ +
{{ gast['nachname'] }}, {{ gast['vorname'] }}, {{ gast['anschrift'] }}, {{ gast['telefonnummer']}}, {{ gast['emailadresse'] }}, {{ gast['id'] }}
+ {{ gast['zeitpunkt'] }} +
+ {% endfor %} +

+#} + +{% endblock %} \ No newline at end of file
ChamäleonCloud Website Impressum Datenschutz