Simple Table
{{ render_table(messages) }}
# |
Text |
Author |
Category |
Draft |
Create Time |
1 |
Message 1 www.t.me |
Author 1 |
Category 1 |
False |
4321 |
2 |
Message 2 https://t.me |
Author 2 |
Category 2 |
True |
8642 |
3 |
Message 3 http://t.me |
Author 3 |
Category 1 |
True |
12963 |
4 |
Message 4 http://t |
Author 4 |
Category 2 |
True |
17284 |
5 |
Message 5 http:// |
Author 5 |
Category 1 |
False |
21605 |
6 |
Message 6 x@t.me |
Author 6 |
Category 2 |
False |
25926 |
7 |
Message 7 mailto:x@t.me |
Author 7 |
Category 1 |
True |
30247 |
8 |
Message 8 www.t.me |
Author 8 |
Category 2 |
True |
34568 |
9 |
Message 9 https://t.me |
Author 9 |
Category 1 |
False |
38889 |
10 |
Message 10 http://t.me |
Author 10 |
Category 2 |
True |
43210 |
Customized Table
{{ render_table(messages, titles, table_classes='table-striped', header_classes='thead-dark', body_classes='table-group-divider', caption='Messages') }}
Messages
# |
Message |
Author |
Category |
Draft |
Create Time |
1 |
Message 1 www.t.me |
Author 1 |
Category 1 |
False |
4321 |
2 |
Message 2 https://t.me |
Author 2 |
Category 2 |
True |
8642 |
3 |
Message 3 http://t.me |
Author 3 |
Category 1 |
True |
12963 |
4 |
Message 4 http://t |
Author 4 |
Category 2 |
True |
17284 |
5 |
Message 5 http:// |
Author 5 |
Category 1 |
False |
21605 |
6 |
Message 6 x@t.me |
Author 6 |
Category 2 |
False |
25926 |
7 |
Message 7 mailto:x@t.me |
Author 7 |
Category 1 |
True |
30247 |
8 |
Message 8 www.t.me |
Author 8 |
Category 2 |
True |
34568 |
9 |
Message 9 https://t.me |
Author 9 |
Category 1 |
False |
38889 |
10 |
Message 10 http://t.me |
Author 10 |
Category 2 |
True |
43210 |
Responsive Table
{{ render_table(messages, responsive=True, responsive_class='table-responsive-sm') }}
# |
Text |
Author |
Category |
Draft |
Create Time |
1 |
Message 1 www.t.me |
Author 1 |
Category 1 |
False |
4321 |
2 |
Message 2 https://t.me |
Author 2 |
Category 2 |
True |
8642 |
3 |
Message 3 http://t.me |
Author 3 |
Category 1 |
True |
12963 |
4 |
Message 4 http://t |
Author 4 |
Category 2 |
True |
17284 |
5 |
Message 5 http:// |
Author 5 |
Category 1 |
False |
21605 |
6 |
Message 6 x@t.me |
Author 6 |
Category 2 |
False |
25926 |
7 |
Message 7 mailto:x@t.me |
Author 7 |
Category 1 |
True |
30247 |
8 |
Message 8 www.t.me |
Author 8 |
Category 2 |
True |
34568 |
9 |
Message 9 https://t.me |
Author 9 |
Category 1 |
False |
38889 |
10 |
Message 10 http://t.me |
Author 10 |
Category 2 |
True |
43210 |
Table with actions
{{ render_table(messages, urlize_columns=('text'), show_actions=True, model=Message,
view_url=('view_message', [('message_id', ':id')]),
edit_url=('edit_message', [('message_id', ':id')]),
delete_url=('delete_message', [('message_id', ':id')]),
new_url=url_for('new_message')) }}
# |
Text |
Author |
Category |
Draft |
Create Time |
Actions
|
1 |
Message 1 www.t.me |
Author 1 |
Category 1 |
False |
4321 |
|
2 |
Message 2 https://t.me |
Author 2 |
Category 2 |
True |
8642 |
|
3 |
Message 3 http://t.me |
Author 3 |
Category 1 |
True |
12963 |
|
4 |
Message 4 http://t |
Author 4 |
Category 2 |
True |
17284 |
|
5 |
Message 5 http:// |
Author 5 |
Category 1 |
False |
21605 |
|
6 |
Message 6 x@t.me |
Author 6 |
Category 2 |
False |
25926 |
|
7 |
Message 7 x@t.me |
Author 7 |
Category 1 |
True |
30247 |
|
8 |
Message 8 www.t.me |
Author 8 |
Category 2 |
True |
34568 |
|
9 |
Message 9 https://t.me |
Author 9 |
Category 1 |
False |
38889 |
|
10 |
Message 10 http://t.me |
Author 10 |
Category 2 |
True |
43210 |
|
Table with custom actions
{{ render_table(messages, show_actions=True, model=Message,
custom_actions=[
(
'Like',
'heart-fill',
('like_message', [('message_id', ':id')])
)
]) }}
# |
Text |
Author |
Category |
Draft |
Create Time |
Actions
|
1 |
Message 1 www.t.me |
Author 1 |
Category 1 |
False |
4321 |
|
2 |
Message 2 https://t.me |
Author 2 |
Category 2 |
True |
8642 |
|
3 |
Message 3 http://t.me |
Author 3 |
Category 1 |
True |
12963 |
|
4 |
Message 4 http://t |
Author 4 |
Category 2 |
True |
17284 |
|
5 |
Message 5 http:// |
Author 5 |
Category 1 |
False |
21605 |
|
6 |
Message 6 x@t.me |
Author 6 |
Category 2 |
False |
25926 |
|
7 |
Message 7 mailto:x@t.me |
Author 7 |
Category 1 |
True |
30247 |
|
8 |
Message 8 www.t.me |
Author 8 |
Category 2 |
True |
34568 |
|
9 |
Message 9 https://t.me |
Author 9 |
Category 1 |
False |
38889 |
|
10 |
Message 10 http://t.me |
Author 10 |
Category 2 |
True |
43210 |
|
Table without SQLAlchemy
The
data
contains a list of dict: [{'field1': 'value', 'field2': 'value', ...}, {...}]
{{ render_table(data, titles) }}
# |
Message |
Author |
Category |
Draft |
Create Time |
1 |
Message 1 www.t.me |
Author 1 |
Category 1 |
False |
4321 |
2 |
Message 2 https://t.me |
Author 2 |
Category 2 |
True |
8642 |
3 |
Message 3 http://t.me |
Author 3 |
Category 1 |
True |
12963 |
4 |
Message 4 http://t |
Author 4 |
Category 2 |
True |
17284 |
5 |
Message 5 http:// |
Author 5 |
Category 1 |
False |
21605 |
6 |
Message 6 x@t.me |
Author 6 |
Category 2 |
False |
25926 |
7 |
Message 7 mailto:x@t.me |
Author 7 |
Category 1 |
True |
30247 |
8 |
Message 8 www.t.me |
Author 8 |
Category 2 |
True |
34568 |
9 |
Message 9 https://t.me |
Author 9 |
Category 1 |
False |
38889 |
10 |
Message 10 http://t.me |
Author 10 |
Category 2 |
True |
43210 |