|
@@ -1,3 +1,18 @@
|
|
|
-from django.shortcuts import render
|
|
|
+from django.views.generic.base import RedirectView
|
|
|
+from django.shortcuts import get_object_or_404
|
|
|
+from django.core.urlresolvers import reverse
|
|
|
|
|
|
-# Create your views here.
|
|
|
+from coin.offers.models import OfferSubscription
|
|
|
+
|
|
|
+
|
|
|
+class ConfigurationRedirectView(RedirectView):
|
|
|
+ """Redirects to the appropriate view for the configuration backend of the
|
|
|
+ specified subscription."""
|
|
|
+
|
|
|
+ permanent = False
|
|
|
+
|
|
|
+ def get_redirect_url(self, *args, **kwargs):
|
|
|
+ subscription = get_object_or_404(OfferSubscription, pk=self.kwargs['id'],
|
|
|
+ member__user=self.request.user)
|
|
|
+ return reverse(subscription.configuration.url_namespace + ':' + subscription.configuration.backend_name,
|
|
|
+ args=[subscription.configuration.pk])
|