15 lines
455 B
Python
15 lines
455 B
Python
"""Site processors to add additional template tags and whatnot."""
|
|
|
|
from django.contrib.sites.shortcuts import get_current_site
|
|
from django.utils.functional import SimpleLazyObject
|
|
|
|
|
|
def site(request):
|
|
site = SimpleLazyObject(lambda: get_current_site(request))
|
|
protocol = 'https' if request.is_secure() else 'http'
|
|
|
|
return {
|
|
'site': site,
|
|
'site_root': SimpleLazyObject(lambda: "{0}://{1}".format(protocol, site.domain)),
|
|
}
|