Skip to content

Instantly share code, notes, and snippets.

@yankchina
Created May 9, 2014 10:47
Show Gist options
  • Save yankchina/c078da664bd7fc1e1aaa to your computer and use it in GitHub Desktop.
Save yankchina/c078da664bd7fc1e1aaa to your computer and use it in GitHub Desktop.
Jinja中创建 rowspan 的样例
{% extends "base.html" %}
{% block title %}{{report.title}}{% endblock %}
{% block titledemo %}{{report.demo_string}}{% endblock %}
{% block content %}
<div class="table-responsive" id="report">
<table class='table table-striped'>
<thead>
{% for item in report.columes %}
<th>{{item}}</th>
{% endfor %}
</thead>
<tbody>
{% for teacher in report.teachers %}
{% set idx = 0 %}
{% for item in teacher.items: %}
{% set idx = idx + 1 %}
<tr>
{% if idx == 1 %}
<td rowspan="{{teacher.row_max_number}}">{{teacher.teacher_name}}({{teacher.teacher_code}})</td>
{% endif %}
<td>{{item.xnxq}}<td>{{item.df}}</td><td>{{item.pm}}</tr>
{% endfor %}
{% endfor %}
</table>
{% endblock %}
@yankchina
Copy link
Author

虽然比较丑,但还是很有用!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment