Package: django-simple-referrals
=============================Django-simple-referrals=============================.. image:: https://badge.fury.io/py/django-simple-referrals.svg:target: https://badge.fury.io/py/django-simple-referrals.. image:: https://travis-ci.org/narnikgamarnikus/django-simple-referrals.svg?branch=master:target: https://travis-ci.org/narnikgamarnikus/django-simple-referrals.. image:: https://codecov.io/gh/narnikgamarnikus/django-simple-referrals/branch/master/graph/badge.svg:target: https://codecov.io/gh/narnikgamarnikus/django-simple-referralsA simple application that allows you to generate referral links and track referralsDocumentation-------------There are two types of referral structure: flat and multilevel.A flat structure means that the user can have referrals, and they will all be on the same level.Multilevel structure means that the user can have children who, in turn, also have children, each of which will be on a level lower (deeper) than the parent.The full documentation is at https://django-simple-referrals.readthedocs.io.Quickstart----------Install referrals::pip install django-simple-referralsAdd it to your `INSTALLED_APPS`:.. code-block:: pythonINSTALLED_APPS = (...'referrals',...)Add referrals's URL patterns:.. code-block:: pythonfrom referrals import urls as referrals_urlsurlpatterns = [...url(r'^referrals/', include('referrals_urls', namespace='referrals')),...]Usage----------1) Override your SignupForm.. code-block:: pythonfrom referrals.widgets import ReferralWidgetfrom referrals.fields import ReferralFieldclass ReferralSignupForm(SignupForm):referral = ReferralField(widget=ReferralWidget())2) After registration, send a signalIf you want to use a flat structure:.. code-block:: pythonfrom referrals.signals import create_flat_referralcreate_flat_referral.send(sender=User, request, user)Or, if you want to use a multi-level structure.. code-block:: pythonfrom referrals.signals import create_multi_level_referralcreate_flat_referral.send(sender=User, request, user, 'position')Where the 'position' must be 'child' or 'sibling'If you pass the value "child", then a child will be created from the referral, by whose link the user has registered.If you specify "sibling", you will create a referral that is at the same level as the user whose link the user is registered with.3) Template tags with referral link:::{% referrals %} # Import template tags{% token %} # Use in any place in your html codeAn incompromise will be created with the button "Copy" by clicking on it, the referral link of this user will be copied to the clipboard.4) Export default variables:.. code-block:: pythonexport DJANGO_REFERRALS_DEFAULT_INPUT_VALUE = '40ed41dc-d291-4358-ae4e-d3c07c2d67dc' # The token to be used by# default. WARNING: Must be uuid4export DJANGO_REFERRALS_FORM_URL = 'http://localhost:8000/accounts/signup/'          # The signup URLFeatures--------* TODO- Create a class for extracting the defaul UUID token- Eliminate a possible error, with a non uuid4 format tokenRunning Tests-------------Does the code actually work?::source <YOURVIRTUALENV>/bin/activate(myenv) $ pip install tox(myenv) $ toxCredits-------Tools used in rendering this package:*  Cookiecutter_*  `cookiecutter-djangopackage`_.. _Cookiecutter: https://github.com/audreyr/cookiecutter.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackageHistory-------0.1.0 (2018-04-13)++++++++++++++++++* First release on PyPI.