Update prepared statement DB backend for Django 1.4
Update auth middleware for Django 1.4

WARNING: This is a hack to code I don't fully understand yet and it is not
well tested.  Further review is necessary.

Django made some changes to its internal APIs for the authentication
middleware.  This broke our customized authentication middleware.
We had a substantial amount of code replacing the Django auth middleware's
request.user object with an ESPUser.  It looks like Django's new lazy
evaluation class will work here.

We may want to restore the part that tries to set request.user when
Django's get_user function doesn't think anyone is logged in, but the user
ID is stored in the session.  I have no idea why this would happen though.

One other thing I changed is to import ESPUser.  This hasn't broken
anything for me, but I bet there was a reason the previous code tiptoed
around importing ESPUser until it was actually necessary, so I would be
cautious here.
Update cache_inclusion_tag to work with Django 1.4

Django's internal APIs for template tags changed.  This attempts to deal
with that by modeling the cache_inclusion_tag's tag generator on some of
Django's tags.

Appears to work for our QSD and catalog tags, but may be broken elsewhere.
Merge remote-tracking branch 'origin/django-1.4-support' into main
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.
Merge branch 'main' of github.com:learning-unlimited/ESP-Website into main
Merge pull request #404 from learning-unlimited/django-1.4-support

Django 1.4 support
Added check availability module.
Changed from list to set for a bit higher efficiency.
Merge pull request #393 from pteromys/stable-jul12-bugfixes

Catalog preview and class documents
Integrated check availability module into availability module, deleted check availability module.
Fixes #239: mail server information moved to config file.
Changed concatenation to string formatting.
Added 'School' Field to onsite reg.

Added 'school' field to onsite student registration as per issue #495.
Field inputs data into 'school' field of studentinfo, but doesn't
fill in 'k12school' field or include the related autocomplete
capabilities. Field is optional.
Teacher events module management web interface.

Altered the existing teacher events module to be able to add and remove teacher training and interview timeslots. The name and friendly name are set automatically with a nice date format.
Fix #284 -- display SplashInfo statistics on dashboard

Since the lunch choices can be overridden by tags, this dynamically
generates entries on the dashboard according to which values have been
selected.
Replaced ADMIN_MEDIA_PREFIX for Django 1.4
Fix "AjaxForeignKeyNewformField has no attribute 'validators'"

Fix AjaxForeignKeyNewformField to properly call
django.forms.fields.Field.__init__(), which creates an attribute
called "validators" which Django 1.4 expects to exist in some places.
Merge branch 'main' into django-1.4-support