diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/sites.txt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/sites.txt b/docs/sites.txt index 12259b04c3..e9982f745a 100644 --- a/docs/sites.txt +++ b/docs/sites.txt @@ -320,3 +320,21 @@ Here's how Django uses the sites framework: .. _flatpages framework: ../flatpages/ .. _syndication framework: ../syndication/ .. _authentication framework: ../authentication/ + +``RequestSite`` objects +======================= + +**New in Django development version** + +Some ``django.contrib`` applications take advantage of the sites framework but +are architected in a way that doesn't *require* the sites framework to be +installed in your database. (Some people don't want to, or just aren't *able* +to install the extra database table that the sites framework requires.) For +those cases, the framework provides a ``RequestSite`` class, which can be used +as a fallback when the database-backed sites framework is not available. + +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``. |
