from .models import Site
[docs]class CurrentSiteMiddleware(object):
"""
Middleware that sets `site` attribute to request object.
"""
def process_request(self, request):
request.site = Site.objects.get_current()
Dec 16, 2014