Skip to content

Commit ab422a6

Browse files
Copilotkarbassi
andcommitted
Limit admin page to show only last 5 classes for better performance
Co-authored-by: karbassi <17738+karbassi@users.noreply.github.com>
1 parent ad6d1a7 commit ab422a6

2 files changed

Lines changed: 1 addition & 13 deletions

File tree

coderdojochi/old_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def cdc_admin(request, template_name="admin.html"):
236236
output_field=IntegerField(),
237237
),
238238
)
239-
.order_by("-start_date")
239+
.order_by("-start_date")[:5]
240240
)
241241

242242
meetings = (

coderdojochi/templates/dashboard/admin.html

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,6 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions|length }}</s
183183
success
184184
{% endif %}
185185
{% endif %}
186-
{% if forloop.counter > 5 %}
187-
collapse session-collapse
188-
{% endif %}
189186
"
190187
>
191188
<td>{{ session.start_date|date:"M j, Y" }}</td>
@@ -258,15 +255,6 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions|length }}</s
258255
</tr>
259256
{% endfor %}
260257
</tbody>
261-
{% if sessions.count > 5 %}
262-
<tfoot>
263-
<tr>
264-
<td colspan="100" class="text-center">
265-
<button class="button" type="button" data-toggle="collapse" data-target=".session-collapse">Show/Hide</button>
266-
</td>
267-
</tr>
268-
</tfoot>
269-
{% endif %}
270258
</table>
271259
{% else %}
272260
<p>No past sessions.</p>

0 commit comments

Comments
 (0)