diff --git a/pinax/stripe/hooks.py b/pinax/stripe/hooks.py index f1d10d6a1..19da66c6a 100644 --- a/pinax/stripe/hooks.py +++ b/pinax/stripe/hooks.py @@ -1,8 +1,6 @@ from django.core.mail import EmailMessage from django.template.loader import render_to_string -from django.contrib.sites.models import Site - class DefaultHookSet(object): @@ -30,6 +28,9 @@ def trial_period(self, user, plan): def send_receipt(self, charge): from django.conf import settings if not charge.receipt_sent: + # Import here to not add a hard dependency on the Sites framework + from django.contrib.sites.models import Site + site = Site.objects.get_current() protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http") ctx = { diff --git a/pinax/stripe/tests/hooks.py b/pinax/stripe/tests/hooks.py index 475cb02f9..2662f1d79 100644 --- a/pinax/stripe/tests/hooks.py +++ b/pinax/stripe/tests/hooks.py @@ -5,8 +5,6 @@ from django.template.loader import render_to_string from django.utils import timezone -from django.contrib.sites.models import Site - from ..hooks import DefaultHookSet @@ -34,6 +32,8 @@ def trial_period(self, user, plan): def send_receipt(self, charge): if not charge.receipt_sent: + from django.contrib.sites.models import Site + site = Site.objects.get_current() protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http") ctx = {