class requests.RequestSite
A class that shares the primary interface of Site
(i.e., it has domain
and name
attributes) but gets its data from a Django HttpRequest
object rather than from a database.
-
__init__(request)
-
Sets the
name
anddomain
attributes to the value ofget_host()
.
A RequestSite
object has a similar interface to a normal Site
object, except its __init__()
method takes an HttpRequest
object. It’s able to deduce the domain
and name
by looking at the request’s domain. It has save()
and delete()
methods to match the interface of Site
, but the methods raise NotImplementedError
.
Please login to continue.