Various fixes to lottery script, mostly to do with multiple priority levels.

* Sections will now be filled from longest to shortest (which was
  previously the case according to a comment but not in reality), and
  rerandomized for each priority level.
* The code that imports preferences will not import any preferences
  corresponding to non-accepted sections.  If it somehow otherwise
  imports preferences for sections it doesn't know about, it will error.
* The code deals more carefully with which things should apply to all
  priority levels (including possibly the one for grade range
  exceptions), and which things should be done only on "real" priority
  levels.
* The error message when classes are full is now correct.
* The try/except for importing preferences is now an actual
  QuerySet.exists() check.
* A test was added for running the lottery with multiple priority
  levels.
Update ThemeController for backup/restore of individual files

This includes functions to check for modifications to the files
(images and scripts) that would normally be copied in by the theme.
The idea is that you ask the user which of the files they would like
to overwrite and which they would like to keep.  For the files they
want to keep, copy them to temporary locations before loading the
theme, then copy them back from the temporary locations.
Update theme views to prompt user for overwriting static files

Loading a theme would normally copy images and scripts to the /media/
dirs.  In many cases users have customized those files (e.g. using the
admin filebrowser) and don't want their changes to be overwritten.  The
typical case is a chapter's logo image.

The solution presented here is to create a new view, confirm_overwrite().
This view is called whenever a difference is detected between the theme
provided files and the files currently in /media.  In this case, the user
has to choose whether to keep or overwrite each file (the default is
keep).  With this form submitted, confirm_overwrite hands control back
to the previous view function (e.g. select() or recompile()) which tells
the ThemeController which files to keep.
Creates missing media dirs
Merge branch 'main' into themes-prevent-overwrite
Make ThemeController.backup_files() keep everything by default

This allows the ThemeController.recompile_theme(), clear_theme(), etc.
functions to be called with no keep_files argument, without overwriting
local changes to theme files.  The default behavior is now to detect and
preserve all local changes.
Add purge_all() function to clear Varnish cache
Clear Varnish cache after theme changes
Merge branch 'themes-prevent-overwrite' of github.com:learning-unlimited/ESP-Website into themes-prevent-overwrite
Add a test case for custom forms

This runs through just the basic functionality (creating a form, filling
out the form, and viewing responses), and it only tests the backend.
However, that is still a lot of code.
Reorganizes myesp/ to remove construction page
Customizes Grappelli

Replaces the Grappelli title with the previous ESP title, and adds
useful admin links to the header bar.
Removes whitespace at start of inline QSD textarea

This caused Markdown rendering problems when the QSD was edited and then
saved without removing the whitespace first.
Fixes Markdown issues in default inline QSD

Improvement to 9c04172a6c42c67eff2a40b5d6a85aad4f22fba6 that applies
lstrip() to all lines of the QSD content, to avoid Markdown code blocks
in the middle of a QSD.
Merge pull request #1022 from learning-unlimited/myesp-404

Reorganizes myesp/ to remove construction page
Merge pull request #1024 from learning-unlimited/grappelli

Customizes Grappelli
Merge pull request #1028 from learning-unlimited/inline-qsd-fixes

Inline qsd fixes
Merge pull request #1045 from learning-unlimited/lottery-fixes

Various fixes to lottery script
Fixes catalog PDF sort

Resolves GitHub issue #1029.
Merge pull request #1054 from learning-unlimited/issue_1029

Fixes catalog PDF sort