Skip to main content

django-referer

django-referer is a Django app for displaying different referer details based on a customizable query parameter and keeping this query parameter while user navigates in the site. It provides sales, partners and affiliates custom links to send out in order to get private traffic. It gives sales, partners and affiliates their opportunity to convert every contact detail on the website to their own. It thus encourages sales, partners and affiliates to promote the website and the business. In addition, with the help of analytics scripts, traffic data can be easily distinguished and analyzed.

Demo

. URL with referer parameter

e.g. https://zhujia.com.au/?refer=14

django-referer Demo - Link with referer

(The chosen query parameter is kept by django-referer’s middleware while user navigates between links)

django-referer Demo 2 - Link with referer

. URL without referer parameter (falls back to the default referer)

e.g. https://zhujia.com.au

django-referer Demo - Link without referer django-referer Demo 2 - Link without referer

Installation

Use the package manager pip to install django-referer.

pip install django-referer

Usage

Step 1. Add referer middleware (in settings.py file)

MIDDLEWARE = [
    'referer.middleware.referer.RefererMiddleware',  # here
    'django.middleware.security.SecurityMiddleware',
    '...'
]

Step 2. Add referer context processor (in settings.py file)

TEMPLATES = [
    {
        'OPTIONS': {
            'context_processors': [
                '...',
                'django.contrib.messages.context_processors.messages',
                'referer.context_processors.referer',  # here
            ],
        },
    },
]

Step 3. Customize referer settings (in settings.py file) (optional)

The defaults are:

REFERER_LINK_PARAMETER = 'referer'
REFERER_DEFAULT_ID = 1
# -> ?referer=1

REFERER_MODEL_FROM = 'django.contrib.auth.models'
REFERER_MODEL_IMPORT = 'User'
# -> from REFERER_MODEL_FROM import REFERER_MODEL_IMPORT

REFERER_IGNORED_LINKS = []

Step 4. Display referer information (in .html file)

<a href="mailto:{{ referer.email }}">Email</a>
<p>{{ referer.first_name }} {{ referer.last_name }}</p>

Contributing

Issues and pull requests are welcomed.

License

MIT © Yifan Ai

Metadata

Release files for django-referer 0.1.0

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-referer 0.1.0
File Size Uploaded Provenance
django-referer-0.1.0.tar.gz 265.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-referer 0.1.0
File Interpreter ABI Platform
django_referer-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 270.5 kB

Release files / django-referer-0.1.0.tar.gz

Download URL django-referer-0.1.0.tar.gz
Size 265.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9c6bc1d25e0473d8a996ef02c13094b53334ece787760b0689c300a7d1e14c02
BLAKE2b-256 checksum
How to use checksums
a8e2abbce5e2ebde49061d1f248b1f4498bb139c07137439e182b7fd8538cad3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

Release files / django_referer-0.1.0-py3-none-any.whl

Download URL django_referer-0.1.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fb5e9aa681081a968c4b560562775a5150e46d23abca365eb48eb4f4b9acc7c
BLAKE2b-256 checksum
How to use checksums
0cdb1df42d4cf1db96bc873ee16312ab1df2c0145815bd0e1e0be76c4a17266e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

Security for django-referer 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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