Closed vaibhav-jain closed 8 years ago
In decorators.py there is a requires_paid_subscription
decorator which is part of the flexible security framework.
What you would do to allow/deny access to certain features (i.e. URLs) based on the subscribed-to Plan
is to decorate the view implementing the feature.
Example: urls.py:
from saas.decorators import requires_paid_subscription
from .views import FeatureView
urlpatterns = [
...
url(r'^(?P<organization>[a-z])/(?P<subscribed_plan>[a-z])/feature/',
requires_paid_subscription(FeatureView.as_view()), name='feature'),
...
]
It is pretty straightforward to create new sets of decorators such that the Plan
does not have to be part of the URL. Let me know if that would be helpful. Maybe something like:
def requires_paid_subscription(function=None,
organization_kwarg_slug='organization',
plans=None): # plans is a list of ``Plan`` organization must be subscribed to.
@smirolo thanks for your reply. I think this we will help us.
I want to know how to implement Plan with features like Freshdesk do. Like they can enable or disable features within a Particular Plan