wg-backend-django/acer-env/lib/python3.10/site-packages/django/contrib/sites/middleware.py
2022-11-30 15:58:16 +07:00

13 lines
309 B
Python

from django.utils.deprecation import MiddlewareMixin
from .shortcuts import get_current_site
class CurrentSiteMiddleware(MiddlewareMixin):
"""
Middleware that sets `site` attribute to request object.
"""
def process_request(self, request):
request.site = get_current_site(request)