carpentries / amy

A web-based workshop administration application built using Django.
https://amy.carpentries.org
MIT License
110 stars 72 forks source link

404 on Training requests view #2314

Closed maneesha closed 1 year ago

maneesha commented 1 year ago

This page is often returning a 404: https://amy.carpentries.org/requests/training_requests/

maneesha commented 1 year ago

@elichad @pbanaszkiewicz Can we close this issue because it will be resolved when #2315 is implemented?

elichad commented 1 year ago

@maneesha the 404 should be resolved by addressing #2315, but the underlying difficulty of displaying a large set of results remains. I just realised this view isn't paginated properly*, which might be the real root of the problem (considering the events page is much faster to load on my machine even with ~4500 results).

*pagination seems to exist, but I think it loads the entire results before rendering, rather than using Django's inbuilt pagination which is better optimised

elichad commented 1 year ago

I've done some poking around on this today. I think the key to this would be to use serverSide: true in the DataTable that renders the training requests. This would prevent the client from loading all 7000 items before creating the pagination. But we'd have to write some new code to handle the subsequent requests from the DataTable to the Django view. There are a few Python packages out there that purport to handle this (which can be found by searching "django datatable serverside"), but it's not clear if they're maintained or reliable. Using Django's inbuilt pagination would avoid that, but the DataTable is used in the specific case of training requests because of old issue #1375.

maneesha commented 1 year ago

Per @elichad we can close this as it is partly addressed by loading a filtered queryset and addressed in issue about datatables (#1512)