Giter Site home page Giter Site logo

django-plans's Introduction

Welcome to django-plans

image

Django-plans is a pluggable app for managing pricing plans with quotas and accounts expiration.

Features currently supported:

  • Multiple plans,
  • Support for user custom plans.
  • Flexible model for parametrizing plans (quota).
  • Customizable billing periods (plan pricing),
  • Order total calculation using customizable taxation policy (e.g. in EU calculating VAT based on seller/buyer countries and VIES)
  • Invoicing,
  • Account expiratons + E-mail remainders.

Documentation: https://django-plans.readthedocs.org/

Master branch: Support for Django >=3.2, support for Python >=3.7

image

image

image

License

Django Plans is licensed and distributed under MIT licesne..

django-plans's People

Contributors

alir3z4 avatar andrzejpiasecki avatar arianerocha avatar brentc avatar chris-morgan avatar cypreess avatar dekoza avatar dependabot[bot] avatar dulacp avatar eriktelepovsky avatar fcurella avatar gzamboni avatar kevwilde avatar nemesifier avatar noirbee avatar noumbissivalere avatar nuurek avatar pandafy avatar petrdlouhy avatar radekholy24 avatar sebastian-engel avatar suvit avatar xordoquy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-plans's Issues

Integration documentation needs more detail

I've been over the documentation a few times and I can't find any information on how to actually integrate with django-plans within our views and models or how to integrate our own payment system (without using django-payments).

I've been able to piece some of it together from the example demo, but that's hardly a substitute for actual documentation.

Python 3 support

Commit BE0897290877 introduces experimental support for py3.3

Is this package maintained anymore ?

Looking at the pull requests and issues being left, i wonder if this project is not mmaintained anymore.

In a project of mine, I need the exact mind functionality, however the package seems to be abandoned.

@cypreess could you please let me know if I can take over the maintainership under @SavandBros, my account or even a new org ?

Quota.codename should be SlugField

Currently the codename and name are easily to confuse. Since the codename accepts any string and is used in Plans quotas inline (where the name should be), it is easy to misuse these two , which can easily lead to errors.

suggestion: allow anonymous viewing of available plans and pricing

use case, generate and display plans with configurable url.

example:

https://proto.io/en/signup/

At the moment this is pretty easy to implement in our own projects, like I am doing :

# file: project/base/views/public.py
...

from plans.views import UpgradePlanView

class PricingPageView(UpgradePlanView):
    template_name = "pages/pricing.html"

# file: project/base/urls/public.py
...

from ..views import public

...
                       surl(r'^pricing/$',     public.PricingPageView.as_view(), name='pricing'),
...

then in the template:

{% extends "flatpages/default.html" %}
{% load i18n %}

{% block page-content %}
    {% include "plans/partials/plan_grid.html" %}
{% endblock %}

Django 1.6 compatibilities ?

Hi,

It does not work with django 1.6:
ImportError at / No module named defaults

Is it planned to make it compatible?

Thanks

Use with django_rest_framework

How this package can be used with django_rest_framework?

Is there some standard implementation for listing plans, pricing and subscribing to the plans and placing orders all from REST framework without using Django templates?

ImproperlyConfigured at /

I'm getting this error after commenting out the #'plans.middleware.UserPlanMiddleware', in settings.py

      Module "plans.context_processors" does not define a "expiration" callable request processor

NoReverseMatch at /admin/plans/userplan/19/

I'm using django-suit and I'm getting this error when I try to modify any user's plan:

Reverse for 'auth_user_change' with arguments '(3,)' and keyword arguments '{}' not found

The user exists, the plan exists, etc. The bug, if any, seems to come from this line in django-plans code. Any ideas on how I could adapt this to work with django-suit? A workaround would be to remove that feature... but wouldn't like to do it that way.

Dynamic plan pricing

Hi,

first of all thanks for sharing this amazing project. It probably saves me a lot of time and coding rage ;-)
I am hoping to integrate it into my customer management system and I have one issue:

Imagine your plan does not contain a fixed number of foos you are allowed to have, but you can have as many as you want. The price increases by a constant value for each foo added before the subscription (the user can't delete foos). Upon subscription the user pays a fixed value + a dynamic value * foos.
So far I have not encountered any way to achieve this properly with django-plans.
I know this is not the usual definition of a plan, but is there a way to integrate dynamic pricing into your project?
I have some experience with python/django myself. So I could do it myself and send you a PR.
So what do you say?

Django-plans handles the registration of the user and the payment?

Hi,

I've some questions that I can't see answers in the documentation.

1- Django-plans can handle the user registration process and payment? If not, what apps will integrate better for handling the Registration and Payment altogether?

2 - There is some tutorial out there to setup the whole process? Registration, choose Plan and Payment?

Best Regards,

Duplicated invoice numbers

I have just bumped to this issue, and I would like to be recorded here as soon as possible, because I think it can cause serious accounting problems. I will post more details, as I will investigate this more deeply.

I have got duplicated invoice numbers on server, where I was testing recurring payments. I noticed, that the duplicated numbers are on invoices from orders with (almost) same creation times (which could is common for invoices for automatically renewed plans).

When I tried to send two payments at exactly the same time, I also got duplicated invoices. So I think, that the problem is present in all versions for some time now. Only it doesn't occur so often in non-recurring payments, because it is quite uncommon to have two purchases at the same time.

'FakePaymentsView' object has no attribute 'request'

Hello,

i got this error with django 1.4.7 and django-plans last version. Debug show me these lines as error:
**

**def get_queryset(self):
return super(FakePaymentsView, self).get_queryset().filter(user=self.request.user)

def dispatch(self, _args, *_kwargs):
if not getattr(settings, 'DEBUG', False):
return HttpResponseForbidden('This view is accessible only in debug mode.')
*_self.object = self.get_object()
return super(FakePaymentsView, self).dispatch(_args, **kwargs)

django-plans works fine with dj 1.6.2 and demo folder, but with 1.4.7 version these two methods ask me to resolve an error hard for me.

Can you help me

thanks
marco

Plans that has available=False & visible=True doesn't show

I think, that plans that are available, but not visible should be still present in the plan table.
This function could be used to show plans that are prepared to be launched or are obsolete.

Is there any other interpretation of this combination of values?

demo project does not work?

HI,

I could not make the "demo" works..

I installed the requirements via pip and the pip_example.req file.

But when I run "python manage.py syncdb", I get this error:
Error: No module named ordered_model

Thanks

Support for a free plan

It appears that there is not a real support for a free plan.
The spec is something like this for me


Spec

  • there can only be one free plan (mutiple free plans it doesn't make sense)
  • a free plan doesn't have an expiration date
  • when the new user grace period ended it falls back to a free default plan if one exists and if quota validations passed

I'm willing to contribute to this one, just want to discuss the specificities with you a little bit, because I'm sure you've already thought about it.

Payments integration

I am trying to integrate django-plans with some payment system (preferably PayPal for my project). I think, that this is not very well documented, and I think, that there could be much bigger part of the code shared between applications.
That is why I started django-plans-payments, which is my attempt for connecting django-plans with django-payments application.

At this moment it is far from being complete, or even usable in any sensible way.

Anyway, I would like to discuss here some details about future of this project and it's integration with payment backends. I am totally open to integrating my code (when complete) with django-plans. I think it would be nice, if it could support more payment backends (like django-getpaid) in the simplest way possible (ideally only by configuration).

What do you think? Do you payment-specific in your projects, that I could use in django-plans-payments?

Activating user account

Hi,

I am using django-plans for the first time.
In my application, I have created plans, quotas and everything. But, whenever I try to send a signal "activate_user_plan", I get an error "DoesNotExist: UserPlan matching query does not exist." at

@receiver(activate_user_plan)
def initialize_plan_generic(sender, user, **kwargs):
    try:
        user.userplan.initialize()
    except UserPlan.DoesNotExist:
        return

Do I have to create a row in UserPlan model before calling this signal.

Missing requirement "six"

the python library six is being imported in plans.enum, but is currently not added as a dependency to this project.

Taxation policies shouldn't be in plans.locale

TL;DR: Can we move plans.locale.*.taxation to plans.taxation.*?

Background

Normally in Django apps, the locale directory would just contain locale/*/LC_MESSAGES/*.[pm]o. Thus, locale is not normally a package inside the app package.

However, plans.locale is a package, containing locale/*/taxation.py, the taxation policies. There are a few problems with this.

Problem 1: it breaks tooling

This causes problems with some tooling, for if you are in the plans directory locale shadows the built-in module locale, meaning that various things simply break. (Normally, in Python 2, it would lack __init__.py and thus not be loaded.) Notably, anything that uses optparse (which uses gettext, which uses locale) will fail. Thus, django-admin.py, pylint and pep8 are three things which immediately fail. This causes minor damage to the way I have Vim set up for myself, but isn't a very serious problem.

Problem 2: it's semantically unsound

Only POSIX locale names belong in there.

Taxation policies are based upon jurisdictions; locales are not. For example, en is a language, English, and is acceptable as a locale identifier but is clearly not useful as an identifier for a taxation policy. Conversely, eu is not a locale, but a jurisdiction useful for such distinctions as taxation policy. (In fact, many locales will be used inside the EU. de, de_at, en, fr, pt, es, etc.)

An example of where this really falls apart: Canada (CA). There are two official languages spoken in Canada, English (en, thus en_CA) and French (fr, thus fr_CA). As it happens, there is also a language with the code ca: Catalan. By the current scheme in plans.locale, any Canadian taxation policy is stuck, as it doesn't belong in en_CA and fr_CA, as it's the same for both of them, nor does it belong in ca, as that is for Catalan. Another example is India: the country is IN, there are many languages inside it en_IN, hi, bn_IN, te, ta, and many more) and in is for Indonesian.

The solution

I suggest that plans.locale.*.taxation be shifted to plans.taxation.* (* encompassing, at present, ru and eu.) This will, incidentally, make plans.taxation a package rather than a module.

Indicate that you're happy with this change and I'm willing to implement it.


(I believe I'm likely to be using this app, and I'm in Australia. I'll need to verify further if the model employed here is appropriate for our GST, but it looks like it.)

enquiry: urlconf and decorators

Is there a specific reason why authorisation decorators (login_required and permission_required) are being used in the urlconf instead of using a loginrequired mixin with the views?

# file: mixins.py
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required


class ProtectedViewMixin(Object):

    @method_decorator(login_required)
    def dispatch(self, *args, **kwargs):
        return super(ProtectedView, self).dispatch(*args, **kwargs)


#file: views.py

from . import mixins

class UserAccountPageView(mixins.ProtectedViewMixin, View):
    pass

just curious.

Expire blank=true null=true

Expire date should allow to store None.

Signal listener set_default_user_plan should set default expire as None. This date should be set only after succesfull account activation in the system.

That implementation allows to use full grace period for account that was registered days ago, but activated after some delay (e.g. due to activation mail delivery problems).

ImportError: No module named loading

Got Exception while installing django-plans
django version == 1.10

File "c:\python27\Lib\importlib_init_.py", line 37, in import_module
import(name)
File "c:\django-projects\venv\src\django-plans\plans\models.py", line 24, in
from plans.contrib import send_template_email, get_user_language
File "c:\django-projects\venv\src\django-plans\plans\contrib.py", line 7, in
from django.db.models.loading import cache
ImportError: No module named loading

Payment aggregator support

Guys,

is there any support for any payment aggregator? I've looked through the docs but didn't find anything helpful.

Sorry if it's described somewhere and I didn't see that.

Using django-plans with recurring payments

Hi, thanks for a great module. I installed and played with the demo and this works beautifully with what I am trying to do. However I need this for a subscription model where someone who is in a plan is on monthly or yearly payments. So I need to generate invoices for that on the same frequency.

Is there a built-in way to handle such payments?

Thanks
Amit

Abstract / Swappable models

Hi,

are you open to the idea of making the logic in the models of django-plans available as abstract / swappable models (using django-swappable)?

We've been using this approach successfully in some modules of the OpenWISP project, eg: django-freeradius.

OpenWISP needs a way to provide features like premium service and periodic paid subscriptions with expiration. I've been reading the code of this package and another package named silver but I'm more inclined to use this package because it feels a lot simpler. The problem is that obviously I will need to customize a few things to integrate it nicely into OpenWISP and the best way to do that without hacks is to have abstract models.

I did something similar a while ago for django-organizations: bennylope/django-organizations#119.

If you are open to the idea I'm proposing I'm available to join forces with you and improve this package.

Compatiblity with django2.0

I think within the new version of django-plans we should bring compatibility with dj2.0 and drop support for python2.x

Install broken on windows

Hi, when I install on windows using the instructions from readthedocs it fails to find the 'plans' app when adding to installed apps. I can see the egg-link which links it to the package under \src but not sure what is going on. Am running in a virtualenv also.

Don

Error Importing middleware

Hello, Thanks for creating this app! After installing, I'm getting the below error. I noticed that middleware.py does not exist in the Plan folder. How can I go about this?

  ImproperlyConfigured: Error importing middleware plans.middleware: "No module named middleware"

Add support for trial plan

We would like to have trial plan with django-plans. It is plan, that is for free, and can be used only once.

Add ecomerce tracking to complete order

I wanted to set up ecomerce tracking for Google Analytics for my plans. All I had to do is override the plans/order_detail.html template with the following code. Do you have interest to include this in this project?

{% extends "plans/order_detail.html" %}
{% load i18n %}

{% block head %}
    {% if object.get_status_display == 'completed' %}
    <script>
    window.dataLayer = window.dataLayer || [];
    dataLayer.push({
       'transactionId': '{{ object.id }}',
       'transactionTotal': {{ object.total }},
       'transactionTax': {{ object.tax_total }},
       'transactionProducts': [{
           'sku': 'P{{ object.plan.id }}',
           'name': '{{ object.name }}',
           'price': {{ object.amount }},
           'quantity': 1
       }]
    });
    </script>
    {% endif %}
    {{ block.super }}
{% endblock %}

Exception Value: 'module' object has no attribute 'EUTaxationPolicy'

Hi! I am trying out your app, I have successfully configured all, but I keep getting this error, while pressing "Change" button to any of my defined plans.

In settings file:
PLANS_TAXATION_POLICY = 'plans.taxation.EUTaxationPolicy'

Traceback ..
Exception Value: 'module' object has no attribute 'EUTaxationPolicy'
/home/user/workspace/env/local/lib/python2.7/site-packages/plans/importer.py in import_name

def import_name(name):
components = name.split('.')
mod = import('.'.join(components[0:-1]), globals(), locals(), [components[-1]] )
return getattr(mod, components[-1])
...

โ–ผ Local vars
Variable Value
name: 'plans.taxation.EUTaxationPolicy'

components: ['plans', 'taxation', 'EUTaxationPolicy']

mod: module 'plans.taxation' from '/home/user/workspace/env/local/lib/python2.7/site-packages/plans/taxation/init.pyc'

It seems wrong to me to use init.py, if "EUTaxationPolicy" is defined in eu.py, or maybe I don't understand something (still learning Python & Django).
Thanks!

Add latest Python support

The code is already working as expected and should handle Python 3.5 and 3.6 with no problem.
Let's find out by travis itself.

suggestion: plans.recommended

A boolean field on the plan model that allows a site administrator to mark one or more plans as recommended.

Or perhaps add django-taggit, which would allow the same problem to be tackled in different ways.

This is different from the default field, as it is primarily used as a sales tool. where as default is there to ensure created users have some sane defaults.

Package Requirements

When attempting to integrate, ran into a few requirements that weren't documented anywhere. Figured I'd list em here if anyone was curious

django-ordered-model
vatnumber
webfault
suds

NoReverseMatch at /admin/plans/order/1/change/

I am getting the following error. Can anybody help me.

Request Method: | POST
Request URL: http://django.vm:8000/admin/plans/order/1/change/
Django Version: 2.0.5
Exception Type: NoReverseMatch
Exception Value: Reverse for 'invoice_preview_html' not found. 'invoice_preview_html' is not a valid view function or pattern name.
Exception Location: /usr/local/lib/python3.4/dist-packages/django/urls/resolvers.py in _reverse_with_prefix, line 632
Python Executable: /usr/bin/python3
Python Version: 3.4.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.