Skip to content

Instantly share code, notes, and snippets.

@kezabelle
Created September 17, 2015 08:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kezabelle/b7ad7ee8e815d0d7293f to your computer and use it in GitHub Desktop.
Save kezabelle/b7ad7ee8e815d0d7293f to your computer and use it in GitHub Desktop.
Just give me the damn Site when I need it mang.
from django.contrib.sites.shortcuts import get_current_site
from django.utils.functional import SimpleLazyObject
def current_site(request):
def wrapped_get_current_site():
return get_current_site(request=request)
return {
'CURRENT_SITE': SimpleLazyObject(wrapped_get_current_site),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment