Documentation for the Code¶
Plan Models¶
The Plan Model is a concrete, swappable subclass of the abstract BasePlan.
- BasePlan
- Plan
-
class
flexible_plans.models.plans.
BasePlan
(*args, **kwargs)[source]¶ BasePlan is TimeStamped, which means it holds a reference to dates of creation and modification. BasePlan is SoftDeletable, which means it becomes deactivated and not removed entirely (to keep a reference to subscribed plans which become soft-deleted and thus no more available).
BasePlan also can be visible and available. Plan is displayed on the list of currently available plans for user if it is visible. User cannot change plan to a plan that is not visible. Available means that user can buy a plan. If plan is not visible but still available it means that user which is using this plan already will be able to extend this plan again. If plan is not visible and not available, he will be forced then to change plan next time he extends an account.
BasePlan is defined by its Features, which can be quotas, permissions on objects and features
-
static
get_default_plan
(cls)[source]¶ Shortcut to retrieve the default plan to be assigned if no plan is selected :param cls: :return: default Plan instance
-
static
Feature Models¶
There are a few Feature concrete, swappable subsclasses of the abstract BaseFeature to represent different types of features with different logic:
- BaseFeature
- Feature
- MeteredFeature
- CumulativeFeature
- PermissionFeature
-
class
flexible_plans.models.features.
BaseFeature
(*args, **kwargs)[source]¶ BaseFeature Abstract Model defines the feature behaviour
-
class
flexible_plans.models.features.
CumulativeFeature
(id, name, codename, description, feature_ptr, usage)[source]¶ -
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
exception
-
class
flexible_plans.models.features.
Feature
(*args, **kwargs)[source]¶ Feature default implementation Feature is a swappable model to allow client to use their own Feature model. It is recommended to subclass BaseFeature to inherit all the behaviours and base fields. Being Feature a base class of other specific Feature Classes, it support an InheritanceManager to return all kinds of objects on Feature querysets
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
exception
Views¶
All the CRUD views are defined and available. Plus, specific views for the Plan management are available