diff --git a/djstripe/migrations/__init__.py b/djstripe/migrations/__init__.py index 79497f0423..8b13789179 100644 --- a/djstripe/migrations/__init__.py +++ b/djstripe/migrations/__init__.py @@ -1,18 +1 @@ -""" -Migrations have been built for Django=>1.7 versions. Alternative migrations -for Django<1.7 users are provided with the ``south_migrations`` dir. -""" - -SOUTH_ERROR_MESSAGE = """\n -For South support, customize the SOUTH_MIGRATION_MODULES setting like so: - SOUTH_MIGRATION_MODULES = { - 'djstripe': 'djstripe.south_migrations', - } -""" - -try: - from django.db import migrations # noqa -except ImportError: - from django.core.exceptions import ImproperlyConfigured - raise ImproperlyConfigured(SOUTH_ERROR_MESSAGE) diff --git a/djstripe/settings.py b/djstripe/settings.py index 8aaf8086a7..c6573737bd 100644 --- a/djstripe/settings.py +++ b/djstripe/settings.py @@ -8,16 +8,12 @@ """ from __future__ import unicode_literals -import sys - from django.apps import apps as django_apps from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils import six from django.utils.module_loading import import_string -PY3 = sys.version > "3" - def get_callback_function(setting_name, default=None): """ @@ -58,19 +54,11 @@ def get_callback_function(setting_name, default=None): PAYMENTS_PLANS = getattr(settings, "DJSTRIPE_PLANS", {}) PLAN_HIERARCHY = getattr(settings, "DJSTRIPE_PLAN_HIERARCHY", {}) -PASSWORD_INPUT_RENDER_VALUE = getattr(settings, 'DJSTRIPE_PASSWORD_INPUT_RENDER_VALUE', False) -PASSWORD_MIN_LENGTH = getattr(settings, 'DJSTRIPE_PASSWORD_MIN_LENGTH', 6) - PRORATION_POLICY = getattr(settings, 'DJSTRIPE_PRORATION_POLICY', False) PRORATION_POLICY_FOR_UPGRADES = getattr(settings, 'DJSTRIPE_PRORATION_POLICY_FOR_UPGRADES', False) CANCELLATION_AT_PERIOD_END = not getattr(settings, 'DJSTRIPE_PRORATION_POLICY', False) SEND_INVOICE_RECEIPT_EMAILS = getattr(settings, "DJSTRIPE_SEND_INVOICE_RECEIPT_EMAILS", True) -CURRENCIES = getattr(settings, "DJSTRIPE_CURRENCIES", ( - ('usd', 'U.S. Dollars',), - ('gbp', 'Pounds (GBP)',), - ('eur', 'Euros',)) -) DEFAULT_PLAN = getattr(settings, "DJSTRIPE_DEFAULT_PLAN", None) diff --git a/djstripe/templatetags/djstripe_tags.py b/djstripe/templatetags/djstripe_tags.py index eb28ab0850..d747fdce81 100644 --- a/djstripe/templatetags/djstripe_tags.py +++ b/djstripe/templatetags/djstripe_tags.py @@ -14,7 +14,7 @@ register = Library() -@register.filter +@register.filter(is_safe=False) def djdiv(value, arg): """ Divide the value by the arg, using Python 3-style division that returns floats. @@ -30,9 +30,6 @@ def djdiv(value, arg): return '' -division.is_safe = False - - @register.filter(name='djstripe_plan_level') def djstripe_plan_level(name): """ diff --git a/djstripe/views.py b/djstripe/views.py index b814e0863f..ee0799beb9 100644 --- a/djstripe/views.py +++ b/djstripe/views.py @@ -37,7 +37,7 @@ # ============================================================================ # -class AccountView(LoginRequiredMixin, SelectRelatedMixin, SubscriptionMixin, PaymentsContextMixin, TemplateView): +class AccountView(LoginRequiredMixin, SubscriptionMixin, PaymentsContextMixin, TemplateView): """Shows account details including customer and subscription details.""" template_name = "djstripe/account.html" diff --git a/docs/settings.rst b/docs/settings.rst index 22e5d2497c..c268792261 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -5,7 +5,7 @@ Settings DJSTRIPE_DEFAULT_PLAN (=None) ============================= -Payment plans default. +Payment plans default. Possibly deprecated in favor of model based plans. @@ -17,7 +17,7 @@ Invoice emails come from this address. DJSTRIPE_PLANS (={}) ==================== -Payment plans. +Payment plans. Possibly deprecated in favor of model based plans. @@ -60,7 +60,7 @@ Example: DJSTRIPE_PLAN_HIERARCHY (={}) ============================= -Payment plans levels. +Payment plans levels. Allows you to set levels of access to the plans. @@ -130,11 +130,11 @@ Example: {% elif customer.subscription|djstripe_plan_level > plan.plan|djstripe_plan_level %}

Downgrade

{% endif %} - + DJSTRIPE_PRORATION_POLICY (=False) ================================== -By default, plans are not prorated in dj-stripe. Concretely, this is how this translates: +By default, plans are not prorated in dj-stripe. Concretely, this is how this translates: 1) If a customer cancels their plan during a trial, the cancellation is effective right away. 2) If a customer cancels their plan outside of a trial, their subscription remains active until the subscription's period end, and they do not receive a refund. @@ -207,7 +207,7 @@ Example Model: name = CharField(max_length=200, unique=True) subdomain = CharField(max_length=63, unique=True, verbose_name="Organization Subdomain") owner = ForeignKey(settings.AUTH_USER_MODEL, related_name="organization_owner", verbose_name="Organization Owner") - + @property def email(self): return self.owner.email @@ -232,7 +232,7 @@ Examples: class DynamicOrganizationIDMiddleware(object): """ Adds the current organization's ID based on the subdomain.""" - + def process_request(self, request): subdomain = parse_subdomain(request.get_host()) @@ -242,7 +242,7 @@ Examples: return TemplateResponse(request=request, template='404.html', status=404) else: organization_id = organization.id - + request.organization_id = organization_id `settings.py` @@ -251,7 +251,7 @@ Examples: def organization_request_callback(request): """ Gets an organization instance from the id passed through ``request``""" - + from import Organization # Import models here to avoid an ``AppRegistryNotReady`` exception return Organization.objects.get(id=request.organization_id) @@ -279,7 +279,7 @@ Examples: Adds a static trial period of 7 days to each subscriber's plan, unless they've accepted our month-long promotion. """ - + if subscriber.coupons.get(slug="monthlongtrial"): return 30 else: @@ -336,8 +336,3 @@ Examples: .. code-block:: python DJSTRIPE_WEBHOOK_EVENT_CALLBACK = 'callbacks.webhook_event_callback' - -DJSTRIPE_CURRENCIES (=(('usd', 'U.S. Dollars',), ('gbp', 'Pounds (GBP)',), ('eur', 'Euros',))) -============================================================================================== - -A Field.choices list of allowed currencies for Plan models. diff --git a/tests/test_urls.py b/tests/test_urls.py index a6fbff063a..b804b30f0f 100644 --- a/tests/test_urls.py +++ b/tests/test_urls.py @@ -9,7 +9,7 @@ def empty_view(request): - return HttpResponse + return HttpResponse() urlpatterns = [