learning-unlimited/ESP-Website — pull request #778 by luac (2013-10-21 07:40:54+00:00)
Title: Fix #776: QuerySet.prefetch_related broken

Fixes a bug in cache_loader where trying to access a many-to-many
field descriptor of a model class (e.g. ClassSection.meeting_times)
threw an error, which confuses prefetch_related. This was happening
because the cache_loader overrides the __get__ methods on these
descriptors to provide extra attributes, but the overriden methods
assumed you were trying to access the field from the instance to get a
ManyRelatedManager, rather than trying to access the field descriptor
from the class.