From 7ae1313cf0e6e6021338f85f59e41a61ebafc377 Mon Sep 17 00:00:00 2001 From: Sergiusz Warga Date: Thu, 15 Oct 2020 23:33:52 +0200 Subject: [PATCH] I don't know it just works --- Pipfile | 13 ++++ Pipfile.lock | 140 +++++++++++++++++++++++++++++++++++ __init__.py | 0 latin.sqlite | Bin 0 -> 12288 bytes main.py | 46 ++++++++++++ templates/coniugationes.html | 41 ++++++++++ templates/latin.html | 10 +++ 7 files changed, 250 insertions(+) create mode 100644 Pipfile create mode 100644 Pipfile.lock create mode 100644 __init__.py create mode 100644 latin.sqlite create mode 100644 main.py create mode 100644 templates/coniugationes.html create mode 100644 templates/latin.html diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..4416d22 --- /dev/null +++ b/Pipfile @@ -0,0 +1,13 @@ +[[source]] +url = "https://pypi.python.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +flask = "*" +flask-sqlalchemy = "*" + +[dev-packages] + +[requires] +python_version = "3.8" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..cb3969d --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,140 @@ +{ + "_meta": { + "hash": { + "sha256": "0304580c13b25ebde937a6853a2a3203f7473be71f8c1d376351033a4d9fce06" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.8" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.python.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "click": { + "hashes": [ + "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a", + "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc" + ], + "version": "==7.1.2" + }, + "flask": { + "hashes": [ + "sha256:4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060", + "sha256:8a4fdd8936eba2512e9c85df320a37e694c93945b33ef33c89946a340a238557" + ], + "index": "pypi", + "version": "==1.1.2" + }, + "flask-sqlalchemy": { + "hashes": [ + "sha256:05b31d2034dd3f2a685cbbae4cfc4ed906b2a733cff7964ada450fd5e462b84e", + "sha256:bfc7150eaf809b1c283879302f04c42791136060c6eeb12c0c6674fb1291fae5" + ], + "index": "pypi", + "version": "==2.4.4" + }, + "itsdangerous": { + "hashes": [ + "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19", + "sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749" + ], + "version": "==1.1.0" + }, + "jinja2": { + "hashes": [ + "sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0", + "sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035" + ], + "version": "==2.11.2" + }, + "markupsafe": { + "hashes": [ + "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", + "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161", + "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235", + "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5", + "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42", + "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff", + "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b", + "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1", + "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e", + "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183", + "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66", + "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b", + "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1", + "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15", + "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1", + "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e", + "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b", + "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905", + "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735", + "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d", + "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e", + "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d", + "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c", + "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21", + "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2", + "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5", + "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b", + "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6", + "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f", + "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f", + "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2", + "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7", + "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be" + ], + "version": "==1.1.1" + }, + "sqlalchemy": { + "hashes": [ + "sha256:072766c3bd09294d716b2d114d46ffc5ccf8ea0b714a4e1c48253014b771c6bb", + "sha256:107d4af989831d7b091e382d192955679ec07a9209996bf8090f1f539ffc5804", + "sha256:15c0bcd3c14f4086701c33a9e87e2c7ceb3bcb4a246cd88ec54a49cf2a5bd1a6", + "sha256:26c5ca9d09f0e21b8671a32f7d83caad5be1f6ff45eef5ec2f6fd0db85fc5dc0", + "sha256:276936d41111a501cf4a1a0543e25449108d87e9f8c94714f7660eaea89ae5fe", + "sha256:3292a28344922415f939ee7f4fc0c186f3d5a0bf02192ceabd4f1129d71b08de", + "sha256:33d29ae8f1dc7c75b191bb6833f55a19c932514b9b5ce8c3ab9bc3047da5db36", + "sha256:3bba2e9fbedb0511769780fe1d63007081008c5c2d7d715e91858c94dbaa260e", + "sha256:465c999ef30b1c7525f81330184121521418a67189053bcf585824d833c05b66", + "sha256:51064ee7938526bab92acd049d41a1dc797422256086b39c08bafeffb9d304c6", + "sha256:5a49e8473b1ab1228302ed27365ea0fadd4bf44bc0f9e73fe38e10fdd3d6b4fc", + "sha256:618db68745682f64cedc96ca93707805d1f3a031747b5a0d8e150cfd5055ae4d", + "sha256:6547b27698b5b3bbfc5210233bd9523de849b2bb8a0329cd754c9308fc8a05ce", + "sha256:6557af9e0d23f46b8cd56f8af08eaac72d2e3c632ac8d5cf4e20215a8dca7cea", + "sha256:73a40d4fcd35fdedce07b5885905753d5d4edf413fbe53544dd871f27d48bd4f", + "sha256:8280f9dae4adb5889ce0bb3ec6a541bf05434db5f9ab7673078c00713d148365", + "sha256:83469ad15262402b0e0974e612546bc0b05f379b5aa9072ebf66d0f8fef16bea", + "sha256:860d0fe234922fd5552b7f807fbb039e3e7ca58c18c8d38aa0d0a95ddf4f6c23", + "sha256:883c9fb62cebd1e7126dd683222b3b919657590c3e2db33bdc50ebbad53e0338", + "sha256:8afcb6f4064d234a43fea108859942d9795c4060ed0fbd9082b0f280181a15c1", + "sha256:96f51489ac187f4bab588cf51f9ff2d40b6d170ac9a4270ffaed535c8404256b", + "sha256:9e865835e36dfbb1873b65e722ea627c096c11b05f796831e3a9b542926e979e", + "sha256:aa0554495fe06172b550098909be8db79b5accdf6ffb59611900bea345df5eba", + "sha256:b595e71c51657f9ee3235db8b53d0b57c09eee74dfb5b77edff0e46d2218dc02", + "sha256:b6ff91356354b7ff3bd208adcf875056d3d886ed7cef90c571aef2ab8a554b12", + "sha256:b70bad2f1a5bd3460746c3fb3ab69e4e0eb5f59d977a23f9b66e5bdc74d97b86", + "sha256:c7adb1f69a80573698c2def5ead584138ca00fff4ad9785a4b0b2bf927ba308d", + "sha256:c898b3ebcc9eae7b36bd0b4bbbafce2d8076680f6868bcbacee2d39a7a9726a7", + "sha256:e49947d583fe4d29af528677e4f0aa21f5e535ca2ae69c48270ebebd0d8843c0", + "sha256:eb1d71643e4154398b02e88a42fc8b29db8c44ce4134cf0f4474bfc5cb5d4dac", + "sha256:f2e8a9c0c8813a468aa659a01af6592f71cd30237ec27c4cc0683f089f90dcfc", + "sha256:fe7fe11019fc3e6600819775a7d55abc5446dda07e9795f5954fdbf8a49e1c37" + ], + "version": "==1.3.19" + }, + "werkzeug": { + "hashes": [ + "sha256:2de2a5db0baeae7b2d2664949077c2ac63fbd16d98da0ff71837f7d1dea3fd43", + "sha256:6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c" + ], + "version": "==1.0.1" + } + }, + "develop": {} +} diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/latin.sqlite b/latin.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..934230838bbfe32c08f5a7404f6b0c41b125f47a GIT binary patch literal 12288 zcmeI$K}*9h6bJC6E9wTLUdAp8@8$-ZARc$nI*JZ!b#)VVDsin6SXb;?^{O99@N@VX z#82SOqse5VAkLdR{2#m|O`3HcpR`})q{|-fbfx7?z literal 0 HcmV?d00001 diff --git a/main.py b/main.py new file mode 100644 index 0000000..f74d3f5 --- /dev/null +++ b/main.py @@ -0,0 +1,46 @@ +from flask import Flask +from flask import render_template +from flask_sqlalchemy import SQLAlchemy +from sqlalchemy import func +from flask_wtf import FlaskForm +from wtforms import Form, RadioField, SubmitField, HiddenField + +app = Flask(__name__) +app.config["SECRET_KEY"] = "asdasfgrwee" +app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///latin.sqlite" +db = SQLAlchemy(app) + +class Word(db.Model): + id = db.Column(db.Integer, primary_key=True) + dictionarium = db.Column(db.String, unique=True, nullable=False) + coniugatio = db.Column(db.Integer, unique=False, nullable=False) + + def __repr__(self): + return '%r; %d conjugation' % (self.dictionarium, self.coniugatio) + +class ConjugatioAnswer(FlaskForm): + radio = RadioField('', choices=[(1, 'Prima'), (2, 'Secunda'), (3, 'Tertia'), (4, 'Quarta')]) + word = HiddenField() + submit = SubmitField('Check') + next_word = SubmitField('Next word') + +@app.route('/latin') +def latin(): + return render_template('latin.html') + +@app.route('/latin/coniugationes') +def coniugationes(): + return render_template('coniugationes.html') + +@app.route('/latin/coniugationes/quod', methods=["GET", "POST"]) +def coniugationes_test(): + form = ConjugatioAnswer() + if form.validate_on_submit(): + word = Word.query.filter_by(dictionarium=form.word.data).first() + if not form.next_word.data: + if int(form.radio.data) == word.coniugatio: + return render_template('coniugationes.html', dictionarium = word.dictionarium, form = form, success = True) + return render_template('coniugationes.html', dictionarium = word.dictionarium, form = form, fail = True) + word = Word.query.order_by(func.random()).first() + form.word.data = word.dictionarium + return render_template('coniugationes.html', dictionarium = word.dictionarium, form = form) diff --git a/templates/coniugationes.html b/templates/coniugationes.html new file mode 100644 index 0000000..b0192f5 --- /dev/null +++ b/templates/coniugationes.html @@ -0,0 +1,41 @@ + + + + + Lingua Latina – Quattuor coniugationes verborum + + +

Quod coniugatio?

+
+

{{dictionarium}}

+ + + {{form.word}} + {{form.csrf_token}} + {% for subfield in form.radio %} + + {{ subfield }} + {{ subfield.label }} + + {% endfor %} + {{form.submit}} + + {%if success %} +
Correct!
+ {{form.next_word}} + {%endif%} + {% if fail %} +
Wrong!
+ {% endif %} + + + \ No newline at end of file diff --git a/templates/latin.html b/templates/latin.html new file mode 100644 index 0000000..2818ead --- /dev/null +++ b/templates/latin.html @@ -0,0 +1,10 @@ + + + + + Lingua Latina + + + Coniugationes + + \ No newline at end of file