Skip to content

Commit 5beee2f

Browse files
authored
howcase app: fix AttributeError with "pure html grid" example when editing/viewing records (#976)
1 parent acf9484 commit 5beee2f

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

apps/showcase/examples/example_html_grid.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,28 @@ def example_html_grid2():
3636

3737
query = db.thing.id > 0
3838
orderby = [db.thing.name]
39-
columns = [field for field in db.thing if field.readable]
40-
columns.insert(0, Column("Custom", lambda row: A("click me")))
4139
grid = Grid(
4240
query,
43-
columns=columns,
41+
columns=[
42+
Column("Custom",
43+
represent=lambda row: A("click me")
44+
),
45+
db.thing.name,
46+
Column("Color",
47+
required_fields=[db.thing.color],
48+
represent=lambda row: I(_class="fa fa-circle", _style="color:" + row.color )
49+
),
50+
db.thing.is_ready,
51+
db.thing.time_created,
52+
db.thing.date_created,
53+
db.thing.timetime_created,
54+
],
4455
search_queries=search_queries,
4556
orderby=orderby,
4657
show_id=False,
4758
T=T,
4859
**grid_param,
4960
)
5061

51-
grid.columns[3].represent = lambda row: I(
52-
_class="fa fa-circle", _style="color:" + row.color
53-
)
5462

5563
return dict(grid=grid)

apps/showcase/templates/index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,20 +167,20 @@
167167
<td><a role="button" href="[[=URL('show/vue_components_examples/vue_file_uploader')]]">example</a></td>
168168
</tr>
169169
<tr>
170-
<td>Insertion form in Vue.</td>
171-
<td><a role="button" href="[[=URL('show/vue_components_examples/vue_insert_form')]]">example</a></td>
170+
<td>Grid + Forms in Vue.</td>
171+
<td><a role="button" href="[[=URL('show/vue_components_examples/vue_grid_and_forms')]]">example</a></td>
172172
</tr>
173173
<tr>
174-
<td>Update form in Vue.</td>
175-
<td><a role="button" href="[[=URL('show/vue_components_examples/vue_edit_form/1')]]">example</a></td>
174+
<td>Grid + Forms in Vue - Insertion.</td>
175+
<td><a role="button" href="[[=URL('show/vue_components_examples/vue_insert_form')]]">example</a></td>
176176
</tr>
177177
<tr>
178-
<td>View form in Vue.</td>
178+
<td>Grid + Forms in Vue - View form (gives 403 error if launched outside grid).</td>
179179
<td><a role="button" href="[[=URL('show/vue_components_examples/vue_view_form/1')]]">example</a></td>
180180
</tr>
181181
<tr>
182-
<td>Grid + Forms in Vue.</td>
183-
<td><a role="button" href="[[=URL('show/vue_components_examples/vue_grid_and_forms')]]">example</a></td>
182+
<td>Grid + Forms in Vue - Update form (gives 403 error if launched outside grid).</td>
183+
<td><a role="button" href="[[=URL('show/vue_components_examples/vue_edit_form/1')]]">example</a></td>
184184
</tr>
185185
<tr>
186186
<td>Star rating component in Vue; example of component instantiation from Vue.</td>
@@ -198,4 +198,4 @@
198198
<td><a role="button" href="[[=URL('show/examples/socketio')]]">socketio</a></td>
199199
</tr>
200200
</table>
201-
</div>
201+
</div>

0 commit comments

Comments
 (0)