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.
Merge branch 'markdown' into mit-prod
Merge branch 'markdown' into mit-prod
Merge branch 'main' into mit-prod
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 mit-prod
Merge branch 'class-flags' into mit-prod

Discussion in #901, I want this for the worksession.
Merge branch 'class-flags' into mit-prod
Merge branch 'edit-walkins-fix' into mit-prod
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 comm panel grade filter to changelog
Initial commit of (existing) program modules docs
Add documentation for management modules
Add documentation for student program modules