mirror of
https://github.com/assenzostefano/class-website.git
synced 2025-06-06 00:39:12 +02:00
Add style on school time table - Remove inutile lines of code
This commit is contained in:
39
app.py
39
app.py
@ -45,45 +45,6 @@ def calendario():
|
|||||||
logging.info("A user went up: Calendario")
|
logging.info("A user went up: Calendario")
|
||||||
return render_template('html/calendario.html')
|
return render_template('html/calendario.html')
|
||||||
|
|
||||||
# Da sistemare
|
|
||||||
@app.route('/api', methods = ['GET', 'POST'])
|
|
||||||
def api():
|
|
||||||
logging.info("A user went up: API")
|
|
||||||
if(request.method == 'GET'):
|
|
||||||
data = "hello world"
|
|
||||||
return jsonify({'data': data})
|
|
||||||
|
|
||||||
@app.route('/login', methods = ['GET', 'POST'])
|
|
||||||
def login():
|
|
||||||
#Create login with Mongodb
|
|
||||||
logging.info("A user went up: Login")
|
|
||||||
message = 'Please login to your account'
|
|
||||||
if "email" in session:
|
|
||||||
return redirect(url_for("logged_in"))
|
|
||||||
|
|
||||||
if request.method == "POST":
|
|
||||||
email = request.form.get("email")
|
|
||||||
password = request.form.get("password")
|
|
||||||
|
|
||||||
|
|
||||||
email_found = records.find_one({"email": email})
|
|
||||||
if email_found:
|
|
||||||
email_val = email_found['email']
|
|
||||||
passwordcheck = email_found['password']
|
|
||||||
|
|
||||||
if bcrypt.checkpw(password.encode('utf-8'), passwordcheck):
|
|
||||||
session["email"] = email_val
|
|
||||||
return redirect(url_for('logged_in'))
|
|
||||||
else:
|
|
||||||
if "email" in session:
|
|
||||||
return redirect(url_for("logged_in"))
|
|
||||||
message = 'Wrong password'
|
|
||||||
return render_template('login.html', message=message)
|
|
||||||
else:
|
|
||||||
message = 'Email not found'
|
|
||||||
return render_template('login.html', message=message)
|
|
||||||
return render_template('login.html', message=message)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
logging.info("Web server started!")
|
logging.info("Web server started!")
|
||||||
app.run(port=4999, debug=True)
|
app.run(port=4999, debug=True)
|
35
static/css/index.css
Normal file
35
static/css/index.css
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
.styled-table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin: 25px 0;
|
||||||
|
font-size: 0.9em;
|
||||||
|
font-family: sans-serif;
|
||||||
|
min-width: 400px;
|
||||||
|
box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.styled-table thead tr {
|
||||||
|
background-color: #009879;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.styled-table th,
|
||||||
|
.styled-table td {
|
||||||
|
padding: 12px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.styled-table tbody tr {
|
||||||
|
border-bottom: 1px solid #dddddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.styled-table tbody tr:nth-of-type(even) {
|
||||||
|
background-color: #f3f3f3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.styled-table tbody tr:last-of-type {
|
||||||
|
border-bottom: 2px solid #009879;
|
||||||
|
}
|
||||||
|
|
||||||
|
.styled-table tbody tr.active-row {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #009879;
|
||||||
|
}
|
@ -1,5 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
{% block styles %}
|
||||||
|
<link rel="stylesheet" type="text/css" href="{{url_for('.static', filename='css/index.css')}}">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
<table>
|
</head>
|
||||||
|
<body>
|
||||||
|
<table class="styled-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Lunedì</th>
|
<th scope="col">Lunedì</th>
|
||||||
<th scope="col">Martedì</th>
|
<th scope="col">Martedì</th>
|
||||||
@ -248,5 +256,5 @@
|
|||||||
<td>{{ i['School Subject']['Saturday'][7]['Room'] }}</td>
|
<td>{{ i['School Subject']['Saturday'][7]['Room'] }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
</body>
|
Reference in New Issue
Block a user