2020-11-22 17:11:23 +01:00
|
|
|
from app import app
|
2020-10-15 23:33:52 +02:00
|
|
|
from flask import render_template
|
2020-11-23 01:15:19 +01:00
|
|
|
import os
|
2020-10-15 23:33:52 +02:00
|
|
|
|
2020-11-22 17:11:23 +01:00
|
|
|
@app.route('/')
|
|
|
|
@app.route('/index')
|
|
|
|
def index():
|
|
|
|
return "Hello, World!"
|
2020-10-15 23:33:52 +02:00
|
|
|
|
|
|
|
@app.route('/latin')
|
|
|
|
def latin():
|
|
|
|
return render_template('latin.html')
|
|
|
|
|
2020-11-22 17:11:23 +01:00
|
|
|
@app.route('/latin/llpsi')
|
|
|
|
def llpsi():
|
2020-11-23 01:15:19 +01:00
|
|
|
return render_template('LLPSI/LLPSI.html')
|
|
|
|
|
|
|
|
@app.route('/latin/llpsi/<path:pensum_id>')
|
|
|
|
def pensum(pensum_id):
|
2020-11-25 21:33:16 +01:00
|
|
|
filename = 'templates/Pensa/' + pensum_id + '.html'
|
2020-11-23 01:15:19 +01:00
|
|
|
with open(filename, 'r') as file:
|
2020-11-25 18:16:27 +01:00
|
|
|
return render_template('LLPSI/Pensum_cloze.html', pensum_title=pensum_id.replace('_', ' '), pensum_content=file.read())
|
2020-11-22 17:11:23 +01:00
|
|
|
|
2020-10-15 23:33:52 +02:00
|
|
|
@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)
|