Django-plans handles the registration of the user and the payment?
lopesandre opened this issue · comments
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,
The short answer is "no".
Ad 1 - django-plans provides only plan management for user. You should integrate it with any other apps, e.g. some obvious choice is django-userena or django-reigstration for user registration. For the payments I only integrated it with my other app - django-getpaid. However there are possibly other payment-processing django apps that will do.
Ad 2 - Docs are here https://django-plans.readthedocs.org/en/latest/ Usually when user register there is a Default plan (selected using model attribute) which is assigned to his account. The user plan is activated within user account activation. All other cases you can see on example project (buying plan extensions, changing plan , etc).
Look at plans/listeners.py. Default plan is always created for the new user, however you need to activate plan by hand, when you now your user account is activated (e.g. first login or registration confirmation).
@receiver(post_save, sender=User)
def set_default_user_plan(sender, instance, created, **kwargs):
"""
Creates default plan for the new user but also extending an account for default grace period.
"""
if created:
default_plan = Plan.get_default_plan()
if default_plan is not None:
UserPlan.objects.create(user=instance, plan=default_plan, active=False, expire=None)
# Hook to django-registration to initialize plan automatically after user has confirm account
@receiver(activate_user_plan)
def initialize_plan_generic(sender, user, **kwargs):
try:
user.userplan.initialize()
except UserPlan.DoesNotExist:
return
try:
from registration.signals import user_activated
@receiver(user_activated)
def initialize_plan_django_registration(sender, user, request, **kwargs):
try:
user.userplan.initialize()
except UserPlan.DoesNotExist:
return
django-registration signals are already supported in code.
Thanks for your reply cypreess.
Another question that is not about this subject. Django-plans1.6 supports only Python2.7? I'm trying to install in Python 2.6 but I got some strange error of 'Invalid Syntax' when I try to syncdb.
?
Best Regards,
I did not use py26 for a long while, so I didn't provide any backward compatibility. Please use 2.7 or possibly 3.3 if possible.