Make class documents show up in catalog preview.

This way, teachers who try to add class documents don't get confused
when said class documents don't show up in the preview.

ClassSubject.objects.catalog is kind of magical and selects a bunch of
related data in one giant query. Our catalog-rendering code assumes
the presence of said data, so wherever we invoke it we should pass it
classes fetched via ClassSubject.objects.catalog.

We could use catalog_cached instead of catalog since correctness of
student counts (if they even appear) isn't important in the catalog
preview. However, the performance hit is tiny since few people even
look at catalog previews--and whatever comes out of render_class_core
*needs* to be correct because that will be cached and reused in the
actual catalog.

(Said observation about caching also implies that student confusion is
a relevant motivation for this fix.)
Make render_class_core depend on qsdmedia.Media.

This is in case teachers upload class documents and then immediately
check the catalog preview to see whether they show up.

Some remarks to the future:

1. This will likely require adjustment when the schema simplification
   project gets merged.

2. Using depend_on_row instead of depend_on_model implies we won't
   catch when a document moves from one class to another. However, I'd
   bet that almost never happens; and I think it's worth not having to
   regenerate the whole catalog every time a teacher uploads a file.

3. This silently fails to empty the right cache if it hits a DataTree
   node with more than one ClassSubject on it. I suspect such DataTree
   errors have enough other symptoms that we can pretend they never
   happen. Also, in a few months, remark 1 will make this irrelevant.
Implements grade range exceptions in the lottery

Adds a setting to the StudentClassRegModuleInfo model --
use_grade_range_exceptions. When this is set, running the lottery
adds another special priority level, below all existing priority
levels, but before the interested level. This level ignores
student grade range when limiting students for a class.
Merge pull request #409 from learning-unlimited/grade_range_exceptions

Grade range exceptions
Fixes #386
Merge pull request #393 from pteromys/stable-jul12-bugfixes

Catalog preview and class documents
Minor tweak of ajax_sections GET handling
Making fraction_full() actually a fraction.
As mailman script is currently unhelpful, disabling for now.
Merge pull request #604 from learning-unlimited/shulinyeMinorFixes

Various minor fixes to small things
Merge branch 'stable-jul12-bugfixes' into main

This is to catch the two commits from pull request #393 which haven't
yet made it into any other branch.

Apologies for dredging up ancient history.
Merge branch 'main' of github.com:learning-unlimited/ESP-Website into main
Make list of classes on teacherreg page update properly

We had a caching bug because the cached inclusion tag
{% render_teacher_list_row %} was accepting 2 additional arguments besides
the class, which made it impossible for cache dependencies (e.g.
depend_on_row, depend_on_cache) to flush the cache for specific classes.
The solution here is to remove the extra arguments.  I was able to restore
the functionality of the friendly_times_with_date argument within the
template tag, but the 'can_edit' isn't going to work (that's a user
dependent variable which is incompatible with this type of caching
anyway).
Prevent integer overflow on program creation form

In case anyone lazily decides to type a very large number on the form,
this avoids an unexplained server error.
Fix code formatting in lottery controller
Partial fix of availability module test

We now have both teach and manage versions of AvailabilityModule, and the
test code expects the teach one.
Fix display of cancelled class sections

We recently changed class cancellation to unschedule any cancelled
sections in order to free up times and rooms.  This means that the
'cancelled classes by time' printable can no longer filter out unscheduled
sections when determining which are cancelled.
Remove teacherinfo from programprintables tests

This view was removed along with the remote teacher profile module in
ca4b4113 so we shouldn't be testing it anymore.
Fix QSD caching bug

Our render_qsd template tag was accepting an optional argument 'user'.
This meant that it was possible for the cache to not be flushed properly
because the key set being deleted didn't match the value of the 'user'
argument that was originally used when the cached HTML was rendered.  We
aren't using the user anyway because edit permissions are handled by
Javascript, so there are no side effects to removing this.  See also
9ad33326.
Add confirm_email to AccountCreationTest

We recently made the account creation forms ask for the e-mail address
twice in order to reduce the number of typos.  This commit updates
AccountCreationTest to provide the e-mail address twice when it submits
the form, in order to avoid unexpected behavior.
Add 'unschedule' option when cancelling classes

When you cancel a class, you might want to unschedule it to free up space
for others.  This is usually desirable well in advance of the program.
However, immediately before or during the program you may want to keep
track of where it had been scheduled, and you have no use for the extra
space.  Now you can choose.