Skip to main content
=============================
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-referrals

A simple application that allows you to generate referral links and track referrals

Documentation
-------------

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-referrals

Add it to your `INSTALLED_APPS`:

.. code-block:: python

INSTALLED_APPS = (
...
'referrals',
...
)

Add referrals's URL patterns:

.. code-block:: python

from referrals import urls as referrals_urls


urlpatterns = [
...
url(r'^referrals/', include('referrals_urls', namespace='referrals')),
...
]



Usage
----------

1) Override your SignupForm

.. code-block:: python

from referrals.widgets import ReferralWidget
from referrals.fields import ReferralField

class ReferralSignupForm(SignupForm):

referral = ReferralField(widget=ReferralWidget())



2) After registration, send a signal

If you want to use a flat structure:

.. code-block:: python

from referrals.signals import create_flat_referral

create_flat_referral.send(sender=User, request, user)



Or, if you want to use a multi-level structure

.. code-block:: python

from referrals.signals import create_multi_level_referral

create_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 code

An 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:: python

export DJANGO_REFERRALS_DEFAULT_INPUT_VALUE = '40ed41dc-d291-4358-ae4e-d3c07c2d67dc' # The token to be used by
# default. WARNING: Must be uuid4

export DJANGO_REFERRALS_FORM_URL = 'http://localhost:8000/accounts/signup/' # The signup URL





Features
--------

* TODO
- Create a class for extracting the defaul UUID token
- Eliminate a possible error, with a non uuid4 format token

Running Tests
-------------

Does the code actually work?

::

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits
-------

Tools used in rendering this package:

* Cookiecutter_
* `cookiecutter-djangopackage`_

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage




History
-------

0.1.0 (2018-04-13)
++++++++++++++++++

* First release on PyPI.

Release files for django-simple-referrals 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-simple-referrals 0.2
File Size Uploaded
django-simple-referrals-0.2.tar.gz 10.9 kB Details

Release files / django-simple-referrals-0.2.tar.gz

Download URL django-simple-referrals-0.2.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
37eb68d6bc4ad05635361a91748e1dc7c1c8584a04ac7d2ba08b46147f65ee58
BLAKE2b-256 checksum
How to use checksums
7f73266d70d6d0a077b958ea4fc35f45b95a2eeadede01615c1ecd83e76363f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file

0.1.32

1 release file

0.1.31

1 release file

0.1.24

1 release file

0.1.23

1 release file

0.1.22

1 release file

0.1.21

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page