summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2021-11-11 08:22:04 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-11-12 06:41:48 +0100
commit78163d1ac4407d59bfc5fdf1f84f2dbbb2ed3443 (patch)
tree87dc9caca2dc88caa0f4fdc7f2561714e8c05f43
parent05cde4764da022ae80e9d7d97ef67c30e896c607 (diff)
Moved RequestSite import to the toplevel.
-rw-r--r--django/contrib/sites/shortcuts.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/contrib/sites/shortcuts.py b/django/contrib/sites/shortcuts.py
index 1a2ee5c384..1131dba1ea 100644
--- a/django/contrib/sites/shortcuts.py
+++ b/django/contrib/sites/shortcuts.py
@@ -1,16 +1,17 @@
from django.apps import apps
+from .requests import RequestSite
+
def get_current_site(request):
"""
Check if contrib.sites is installed and return either the current
``Site`` object or a ``RequestSite`` object based on the request.
"""
- # Imports are inside the function because its point is to avoid importing
- # the Site models when django.contrib.sites isn't installed.
+ # Import is inside the function because its point is to avoid importing the
+ # Site models when django.contrib.sites isn't installed.
if apps.is_installed('django.contrib.sites'):
from .models import Site
return Site.objects.get_current(request)
else:
- from .requests import RequestSite
return RequestSite(request)