You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

middleware.py 309B

5 years ago
123456789101112
  1. from django.utils.deprecation import MiddlewareMixin
  2. from .shortcuts import get_current_site
  3. class CurrentSiteMiddleware(MiddlewareMixin):
  4. """
  5. Middleware that sets `site` attribute to request object.
  6. """
  7. def process_request(self, request):
  8. request.site = get_current_site(request)