Commit f0d2010 1 parent 9cef6b4 commit f0d2010 Copy full SHA for f0d2010
File tree 1 file changed +0
-29
lines changed
1 file changed +0
-29
lines changed Original file line number Diff line number Diff line change 1
- from django .conf import settings
2
- from django .http import HttpRequest
3
-
4
- from furl import furl
5
-
6
-
7
- def get_domain () -> str :
8
- """
9
- Obtain the domain/netloc according to settings or configuration.
10
- """
11
- from django .contrib .sites .models import Site
12
-
13
- if settings .OBJECTTYPES_DOMAIN :
14
- return settings .OBJECTTYPES_DOMAIN
15
-
16
- return Site .objects .get_current ().domain
17
-
18
-
19
- def build_absolute_url (path : str , request : HttpRequest | None = None ) -> str :
20
- if request is not None :
21
- return request .build_absolute_uri (path )
22
-
23
- domain = get_domain ()
24
- _furl = furl (
25
- scheme = "https" if settings .IS_HTTPS else "http" ,
26
- netloc = domain ,
27
- path = path ,
28
- )
29
- return _furl .url
You can’t perform that action at this time.
0 commit comments