              # Do something
          else:
              # Do something else.
  
  The idiom of retrieving the :class:`~django.contrib.sites.models.Site` object
  for the value of :setting:`settings.SITE_ID <SITE_ID>` is quite common, so
  the :class:`~django.contrib.sites.models.Site` model's manager has a
  ``get_current()`` method. This example is equivalent to the previous one::
  
      from django.contrib.sites.models import Site
  
      def my_view(request):
          current_site = Site.objects.get_current()
 
</s> remove     def my_view(request):
 </s> add     def my_function_without_request(): </s> remove hard-coding is best for hackish fixes that you need done quickly. A slightly
 </s> add hard-coding is best for hackish fixes that you need done quickly. The </s> remove     from django.conf import settings
    from django.contrib.sites.models import Site
 </s> add     from django.contrib.sites.models import get_current_site </s> remove   checks the current :setting:`SITE_ID` in retrieving flatpages to display.
 </s> add   checks the current site in retrieving flatpages to display. </s> remove For code which relies on getting the current domain but cannot be certain
that the sites framework will be installed for any given project, there is a
utility function :func:`~django.contrib.sites.models.get_current_site` that
takes a request object as an argument and returns either a Site instance (if
the sites framework is installed) or a RequestSite instance (if it is not).
This allows loose coupling with the sites framework and provides a usable
fallback for cases where it is not installed.

.. function:: get_current_site(request)

    Checks if contrib.sites is installed and returns either the current
    :class:`~django.contrib.sites.models.Site` object or a
    :class:`~django.contrib.sites.models.RequestSite` object based on
    the request.

 </s> add 
This has also the advantage of checking if the sites framework is installed, and
return a :class:`RequestSite` instance if it is not.

If you don't have access to the request object, you can use the
``get_current()`` method of the :class:`~django.contrib.sites.models.Site`
model's manager. You should then ensure that your settings file does contain
the :setting:`SITE_ID` setting. This example is equivalent to the previous one::
              # Do something
          else:
              # Do something else.
  
This has also the advantage of checking if the sites framework is installed, and
return a :class:`RequestSite` instance if it is not.

If you don't have access to the request object, you can use the
``get_current()`` method of the :class:`~django.contrib.sites.models.Site`
model's manager. You should then ensure that your settings file does contain
the :setting:`SITE_ID` setting. This example is equivalent to the previous one::
This has also the advantage of checking if the sites framework is installed, and
return a :class:`RequestSite` instance if it is not.

If you don't have access to the request object, you can use the
``get_current()`` method of the :class:`~django.contrib.sites.models.Site`
model's manager. You should then ensure that your settings file does contain
the :setting:`SITE_ID` setting. This example is equivalent to the previous one::
This has also the advantage of checking if the sites framework is installed, and
return a :class:`RequestSite` instance if it is not.

If you don't have access to the request object, you can use the
``get_current()`` method of the :class:`~django.contrib.sites.models.Site`
model's manager. You should then ensure that your settings file does contain
the :setting:`SITE_ID` setting. This example is equivalent to the previous one::
This has also the advantage of checking if the sites framework is installed, and
return a :class:`RequestSite` instance if it is not.

If you don't have access to the request object, you can use the
``get_current()`` method of the :class:`~django.contrib.sites.models.Site`
model's manager. You should then ensure that your settings file does contain
the :setting:`SITE_ID` setting. This example is equivalent to the previous one::
  
      from django.contrib.sites.models import Site
  
      def my_view(request):
          current_site = Site.objects.get_current()
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Made more extensive use of get_current_site

Refs #15089 
docs/ref/contrib/sites.txt