Created
August 20, 2023 05:05
-
-
Save ahmaddidiks/2c236212b5b6494a78c085a97fd9450e to your computer and use it in GitHub Desktop.
Flask show table data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> | |
<h1>Absensi Murid</h1> | |
<table id="demo"> | |
{% for u in murid %} | |
<tr> | |
<td>{{ u[0] }}</td> | |
<td>{{ u[1] }}</td> | |
<td>{{ u[2] }}</td> | |
</tr> | |
{% endfor %} | |
</table> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template, Response | |
from datetime import datetime | |
app = Flask(__name__) | |
@app.route('/') | |
def index(): | |
masuk = datetime.now().date() | |
keluar = datetime.now().date() | |
user = [['Nama', 'Masuk', 'Keluar']] | |
user.append(['Didik', masuk, keluar]) | |
user.append(['Paijo', masuk, keluar]) | |
return render_template('index.html', murid=user) | |
if __name__ == '__main__': | |
app.run(host='0.0.0.0', debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment