Skip to main content

django-sales is a Django app for displaying different contact details based on query parameter (with cookie). It provides sales, partners and affiliates custom links to send out to the public. 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.

Installation

Use the package manager pip to install django-sales.

pip install django-sales

Usage

Step 1. Add sales app (in settings.py file)

INSTALLED_APPS = [
    '...',
    'django.contrib.staticfiles',
    'sales',  # here
    'myapp',
    '...',
]

Make sure sales app is before all custom apps. Otherwise, Django will not recognize the ‘sales’ template tag.

Step 2. Add sales middleware (in settings.py file)

MIDDLEWARE = [
    'sales.middleware.sales.SalesMiddleware',  # here
    'django.middleware.security.SecurityMiddleware',
    '...'
]

Step 3. Add sales context processors (in settings.py file)

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

Step 4. Customize sales settings (in settings.py file) (optional)

The defaults are:

SALES_LINK_PARAMETER = 'sales'
SALES_DEFAULT_ID = 1  # ?sales=1
SALES_COOKIE_NAME = 'sales'
SALES_COOKIE_MAX_AGE = 3600  # 1 hour
SALES_MODEL_FROM = 'django.contrib.auth.models'
SALES_MODEL_IMPORT = 'User'  # from SALES_MODEL_FROM import SALES_MODEL_IMPORT

In version 0.0.1, django-sales makes use of django.contrib.auth.models.User model, which can be easily extended according to your needs. (e.g. Add a phone number field) From version 0.1.0, django-sales allows developer to specify the Sales model to lookup sales, partners and affiliates.

Step 5. Load sales tag (in any .html file)

{% load static %}
{% load sales %}  # here

Step 7. Display sales information (in relevant .html files)

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

Contributing

Pull requests are welcome.

License

MIT

Metadata

Release files for django-sales 0.1.3

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-sales 0.1.3
File Size Uploaded Provenance
django-sales-0.1.3.tar.gz 3.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-sales 0.1.3
File Interpreter ABI Platform
django_sales-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 10.9 kB

Release files / django-sales-0.1.3.tar.gz

Download URL django-sales-0.1.3.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
83986f3a9f03a53892fbadcd808fe503eeef0d91ba28b41a37c953185d7aeccd
BLAKE2b-256 checksum
How to use checksums
d851abcfc5dba128d2dbf1da861d6d82144419edfd6a3dddfae9e5f598b1d0a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Release files / django_sales-0.1.3-py3-none-any.whl

Download URL django_sales-0.1.3-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b39f7f6d65e54ba7e212443f8ae6387e9113ddb0bd03d3fcef33d8a7840ef6e
BLAKE2b-256 checksum
How to use checksums
d8e6f821291fbd9bdac2061c71aa47a07c91e8f998dc3d4d6d2603e3fef92340
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Security for django-sales 0.1.3

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