Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django: Actions that provide intermediate pages ... with 100k rows

I know how to write Actions that provide intermediate pages, since the docs are great:

https://docs.djangoproject.com/en/2.0/ref/contrib/admin/actions/#actions-that-provide-intermediate-pages

But, if my selection contains 100k rows, the pattern of the docs does not work since the URL gets too long.

How to write Django Admin Actions that provide intermediate pages and can handle +100k rows?

like image 775
guettli Avatar asked Apr 12 '18 13:04

guettli


Video Answer


1 Answers

I solved it this way:

  • Pickle QuerySets
  • Store pickled QuerySet in the cache under a random ID
  • forward the random ID to the next page
  • the next pages use the random ID to read the QuerySet from the cache.
like image 135
guettli Avatar answered Oct 02 '22 16:10

guettli