Skip to content

Instantly share code, notes, and snippets.

View shangxiao's full-sized avatar

David Sanders shangxiao

View GitHub Profile
@kezabelle
kezabelle / crapsite_contextprocessor.py
Created September 17, 2015 08:05
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),
}