Skip to main content

Display different contact details based on query parameter and cookie

Project description

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.


Use the package manager pip to install django-sales.

pip install django-sales


Step 1. Add sales app (in file)

    'sales',  # here

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

Step 2. Add sales middleware (in file)

    'sales.middleware.sales.SalesMiddleware',  # here

Step 3. Add sales context processors (in file)

        'OPTIONS': {
            'context_processors': [
                'sales.context_processors.sales',  # here

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

The defaults are:

SALES_DEFAULT_ID = 1  # ?sales=1
SALES_COOKIE_MAX_AGE = 3600  # 1 hour
SALES_MODEL_FROM = 'django.contrib.auth.models'

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:{{ }}">Email</a>
<p>{{ sales.first_name }} {{ sales.last_name }}</p>


Pull requests are welcome.



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-sales-0.1.3.tar.gz (3.7 kB view hashes)

Uploaded source

Built Distribution

django_sales-0.1.3-py3-none-any.whl (7.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page