Debian Codegraph @

django/contrib/sites/requests.py

raw
1 class RequestSite:
2 """
3 A class that shares the primary interface of Site (i.e., it has ``domain``
4 and ``name`` attributes) but gets its data from an HttpRequest object
5 rather than from a database.
6
7 The save() and delete() methods raise NotImplementedError.
8 """
9
10 def __init__(self, request):
11 self.domain = self.name = request.get_host()
12
13 def __str__(self):
14 return self.domain
15
16 def save(self, force_insert=False, force_update=False):
17 raise NotImplementedError("RequestSite cannot be saved.")
18
19 def delete(self):
20 raise NotImplementedError("RequestSite cannot be deleted.")