Created
October 18, 2023 10:22
-
-
Save jfjensen/4c1041ee48a65c58ee27b1480443c695 to your computer and use it in GitHub Desktop.
A Jinja template used to dynamically create an HTML table to display a list of users for a Litestar app
This file contains 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> | |
<title>User listing</title> | |
<style> | |
table { | |
font-family: arial, sans-serif; | |
border-collapse: collapse; | |
width: 100%; | |
} | |
td, th { | |
border: 1px solid #dddddd; | |
text-align: left; | |
padding: 8px; | |
} | |
tr:nth-child(even) { | |
background-color: #dddddd; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>User listing</h1> | |
<table> | |
<tr> | |
<th>Name</th> | |
<th>Age</th> | |
<th>Email</th> | |
</tr> | |
{% for user in users %} | |
<tr> | |
<td>{{user.name}}</td> | |
<td>{{user.age}}</td> | |
<td>{{user.email}}</td> | |
</tr> | |
{% endfor %} | |
</table> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment