Skip to main content

A reusable Django referral system app

Project description

django-referral

# Django Referral App

A reusable Django app for implementing a referral system.  
It allows users to generate unique referral links and track sign-ups using those links.

---

## Features
- Generate unique referral codes for each user
- Track referrals from sign-up
- Optionally reward users for successful referrals

---

## Installation

### 1. Install via pip
First, install the app directly from GitHub (or PyPI if you publish it there):

```bash
pip install git+https://github.com/Andrew-oduola/django-referral.git

2. Add to INSTALLED_APPS

In your Django project's settings.py:

INSTALLED_APPS = [
    ...
    'referral',  # Add this line
]

3. Run Migrations

Run the migrations to create the necessary database tables:

python manage.py migrate referral

4. Add Middleware (Optional - if using cookies for referral tracking)

In settings.py:

MIDDLEWARE = [
    ...
    'referral.middleware.ReferralMiddleware',
]

5. Usage

Generate a referral link

Example: If a user has referral_code="ABC123", their referral link will look like:

https://yourdomain.com/signup?ref=ABC123

Handle sign-ups with referrals

When a new user signs up using a referral link:

  • The app detects the referral code
  • Links the new user to the referrer
  • Saves the relationship in the database

Development Setup (Optional)

If you want to modify or develop the app locally:

git clone https://github.com/yourusername/django-referral-app.git
cd django-referral-app
pip install -r requirements.txt

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-referral2-0.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_referral2-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file django-referral2-0.1.0.tar.gz.

File metadata

  • Download URL: django-referral2-0.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for django-referral2-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c45135601d1e6626aaa4d07ef11f11bd0cb0cd582fb65f7191d5ac58132987dc
MD5 46aeb82394afadb6d103c93e3e99fe69
BLAKE2b-256 6cc7ba4f60ce05d9b15897fdeb7daa99f223a90cbbf81f137dc1a334522049e8

See more details on using hashes here.

File details

Details for the file django_referral2-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_referral2-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 336f81e9b59ec89a5402034ffb22df8162959f2ceee647022c999e4bec7da5ca
MD5 5317d73dd53f4ba59490eeb0582acad9
BLAKE2b-256 fef53ee146c0efc470c3e4ca3f3a096eb981833a84d9c0dba66d91bf88786604

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page