Skip to main content
# Simple Affiliate System for Django


This is a very simple library that can be used to provide affiliate links in your django application.
It is intentionally very lightweight, allowing your application to do whatever it wants with the data.

The project is very loosely inspired by the [django-affiliate](https://github.com/st4lk/django-affiliate) library,
though seeks to provide a lighter-weight way to provide the core set of functionality without requiring the
use of any additional data models.

If you are looking for a more heavyweight/comprehensive solution you may be better off with
[django-affiliate](https://github.com/st4lk/django-affiliate).

## How it Works


You give a code to each partner you want to send links to your application.
They choose a link that includes their code in an `aid` parameter in the URL. E.g.

`http://example.com/?aid=12345`

This code is saved in the django session using a middleware, which also adds the id to the request
as `request.affiliate_id` (note: the ID will also be added if there was no URL param but an id was found
already in the session).

Then you can use whatever custom processing logic you want on the `request.affiliate_id` throughout the
rest of your code.

## Requirements

- python (only tested on 3.5 but should work in 2.7)
- django (only tested in 1.11 but might work with older versions)


## Quick start

1. Install this package to your python distribution

`pip install django-affiliate`

2. Add `'simple_affiliate.middleware.affiliate_middleware'` to `MIDDLEWARE`:

```python
MIDDLEWARE = (
# ...
'simple_affiliate.middleware.affiliate_middleware',
)
```

3. Reward / track affiliate

```python
if request.affiliate_id and made_some_cash(request):
pay_affiliate_by_id(request.affiliate_id, dollar_value(request)
```

## Project Todos

- [] Add / document expiration timeout functionality
- [] Add tests


Release files for django-simple-affiliate 0.1

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-affiliate 0.1
File Size Uploaded
django-simple-affiliate-0.1.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-simple-affiliate 0.1
File Interpreter ABI Platform
django_simple_affiliate-0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 9.0 kB

Release files / django-simple-affiliate-0.1.tar.gz

Download URL django-simple-affiliate-0.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
29c0c5c796914fa2d5b76addd199dec4c82a951f52d1bc6a7b2e3c61ffdbedbe
BLAKE2b-256 checksum
How to use checksums
6051a97796558e44e2e14b5fa1f8425c1e0ccf148e5c11064b233f27c7fb8f3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_simple_affiliate-0.1-py2.py3-none-any.whl

Download URL django_simple_affiliate-0.1-py2.py3-none-any.whl
Size 5.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
bf9b636950ac191ce46618399be405a3d279d6dbd9ae490d11950dd12f9c69f0
BLAKE2b-256 checksum
How to use checksums
d2fab147b3785ee79193fcc83359338bccc18050dabd03e3f4d3d4b423be485f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

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