質問編集履歴
1
コードを足した
test
CHANGED
File without changes
|
test
CHANGED
@@ -70,6 +70,100 @@
|
|
70
70
|
|
71
71
|
|
72
72
|
|
73
|
+
```html
|
74
|
+
|
75
|
+
{% extends "layout.html" %}
|
76
|
+
|
77
|
+
{% block content %}
|
78
|
+
|
79
|
+
<form action="{{ url_for('PDFPage')}}" method="post">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
<!-- CHANGE HERE FROM ... -->
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
<table>
|
88
|
+
|
89
|
+
{% for num,info in hoge %}
|
90
|
+
|
91
|
+
{% if num <= loaded_img %}
|
92
|
+
|
93
|
+
<tr>
|
94
|
+
|
95
|
+
<td>
|
96
|
+
|
97
|
+
<input type="checkbox" name="more_than_zero" checked>
|
98
|
+
|
99
|
+
</td>
|
100
|
+
|
101
|
+
<td><img src="static/{{ f_name }}/{{num}}.jpg" width="10%" height="10%"></td>
|
102
|
+
|
103
|
+
<td>{{info[0]}}</td>
|
104
|
+
|
105
|
+
<td>{{info[2]}}</td>
|
106
|
+
|
107
|
+
<td>
|
108
|
+
|
109
|
+
<select name="card_num">
|
110
|
+
|
111
|
+
<option>{{info[2].rstrip("枚")|int}}枚</option>
|
112
|
+
|
113
|
+
{% for i in range(info[2].rstrip("枚")|int)[::-1] %}
|
114
|
+
|
115
|
+
<option>{{i}}枚</option>
|
116
|
+
|
117
|
+
{% endfor %}
|
118
|
+
|
119
|
+
</select>
|
120
|
+
|
121
|
+
</td>
|
122
|
+
|
123
|
+
</tr>
|
124
|
+
|
125
|
+
{% endif %}
|
126
|
+
|
127
|
+
{% endfor %}
|
128
|
+
|
129
|
+
</table>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<!-- HERE -->
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
<button type="submit">PDFを出力</button>
|
138
|
+
|
139
|
+
</form>
|
140
|
+
|
141
|
+
{% endblock %}
|
142
|
+
|
143
|
+
```
|
144
|
+
|
145
|
+
```Python
|
146
|
+
|
147
|
+
def generate_output():
|
148
|
+
|
149
|
+
i = gen.__next__()
|
150
|
+
|
151
|
+
while True:
|
152
|
+
|
153
|
+
try:
|
154
|
+
|
155
|
+
yield render_template('result.html',secret=enumerate(d.secretk),f_name=new_name,loaded_img=i)
|
156
|
+
|
157
|
+
except:
|
158
|
+
|
159
|
+
break
|
160
|
+
|
161
|
+
i = gen.__next__()
|
162
|
+
|
163
|
+
return Response(stream_with_context(generate_output()))
|
164
|
+
|
165
|
+
```
|
166
|
+
|
73
167
|
参考
|
74
168
|
|
75
169
|
http://flask.pocoo.org/docs/1.0/patterns/streaming/
|