Skip to main content

Bluelight Specials - Enhancements to the offer and vouchers features for Django Oscar.

Project description

license kit format downloads

This package contains enhancements and improvements to the built-in offers and vouchers features in Django Oscar.

Features

  • Group Restricted Vouchers: Bluelight adds the ability to restrict application of vouchers to a specific whitelist of groups (django.contrib.auth.models.Group). For example, you could create a voucher code that can only be applied by users who belong to the group Customer Service Reps.

  • Compound Offer Conditions: By default, Oscar only allows assigning a single condition to a promotional offer. Compound offer conditions allow you to create more complex logic around when an offer should be enabled. For example, you could create a compound condition specifying that a basket must contain at least 3 items and have a total value greater than $50.
    • Compound conditions can aggregate an unlimited number of child conditions together.

    • Compound conditions can join their child conditions using either an AND or an OR conjunction.

    • Very complex conditions requiring both AND and OR conjunctions can be modeled by creating multiple levels of compound conditions.

  • Parent / Child Voucher Codes: By default Oscar doesn’t support bulk creation of voucher codes. Bluelight adds the ability to bulk create any number of child vouchers (with unique, automatically generated codes) for any standard (non-child) voucher. This can be useful when sending voucher codes to customer’s through email, as it allows the creation of hundreds or thousands of non-sequential, one-time-use codes.
    • Child codes can be added when creating a new voucher or after a voucher is created.

    • More child codes can be generated for a voucher at any time.

    • Child codes can be exported in CSV and JSON formats.

    • Any time a parent voucher is edited (name changed, benefit altered, etc), all child codes are also updated to match.

    • When a parent voucher is deleted, all children are also deleted.

    • Once a voucher has child codes assigned to it, the parent voucher itself can not be applied by anyone.

Roadmap

  • Make child code creation and updating more performant, possibly by (1) extracting some of the work into asynchronous Celery tasks and (2) better tracking of dirty model fields before saving.

  • Add ability to duplicate vouchers.

  • Add ability to add conditions to vouchers.

Caveats

Bluelight currently works by forking four of Oscar’s apps: offer, voucher, dashboard.offers, and dashboard.vouchers. Currently there is no way to use Bluelight if your application has already forked those applications.

Installation

Install django-oscar-bluelight.:

$ pip install django-oscar-bluelight

Import Bluelight’s settings into your projects settings.py file.:

from oscar.defaults import *
from oscarbluelight.defaults import *  # NOQA # Needed so that Bluelight's views show up in the dashboard
from oscar import OSCAR_MAIN_TEMPLATE_DIR, get_core_apps
from oscarbluelight import BLUELIGHT_TEMPLATE_DIR

Add Bluelight to your install apps.:

INSTALLED_APPS = [
    ...
] + get_core_apps([
    ...
    'oscarbluelight.dashboard.offers',
    'oscarbluelight.dashboard.vouchers',
    'oscarbluelight.offer',
    'oscarbluelight.voucher',
    ...
])

Add Bluelight’s template directory directly before Oscar’s.:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            BLUELIGHT_TEMPLATE_DIR,
            OSCAR_MAIN_TEMPLATE_DIR,
        ],
        ...
    }
]

Fork the basket application in your project and add BluelightBasketMixin as a parent class of the Line model.:

from oscar.apps.basket.abstract_models import AbstractLine
from oscarbluelight.mixins import BluelightBasketLineMixin

class Line(BluelightBasketLineMixin, AbstractLine):
    pass

from oscar.apps.basket.models import *  # noqa

Usage

After installation, the new functionality will show up in the Oscar dashboard under the Offers menu.

Changelog

0.6.0

  • Add concept of Offer groups.
    • This makes it possible to create promotions which overlap on line items.

  • Add API for determining why a line was discounted.

0.5.4

  • Improve unit testing with tox.

0.5.3

  • Upgrade test dependencies.

0.5.2

  • Upgraded to versiontag 1.2.0.

0.5.1

  • Fixed bug where voucher condition range was always set to be equal to the benefit range.

0.5.0

  • Create custom subclasses of all built-in Oscar conditions and Benefits
    • Eliminates need for monkey-patching the Condition.consume_items method.

    • Adds migration to change all row’s proxy_class from oscar.apps.offer.FOOBAR to oscarbluelight.offer.FOOBAR.

  • Change behavior of FixedPriceBenefit to be more logical.
    • Uses the benefit’s assigned range instead of the condition’s range.

    • Respects the max_affected_items setting.

  • Improved dashboard form validation using polymorphic _clean methods on benefits and conditions.

  • Disallow deleting a range when a benefit or a condition depends on it.

  • If a benefit or condition’s proxy_class isn’t a proxy_model, automatically create the row in the subclass’s table.

0.4.1

  • Fixed several exceptions throw in dashboard views when a voucher had no offers linked to it.

0.4.0

  • Dashboard:
    • Separate vouchers form offers in benefits and conditions lists

    • Add condition field to voucher form. Allows creating more complex vouchers, such as those that require specific items in the basket.

    • Add priority field to vouchers and offers forms. Display priority field in detail and list fields.

    • Add offer restrictions fields to voucher form.

  • Performance:
    • Move child code creation and updating background task with Celery.

0.3.1

  • Use correct transaction.atomic syntax in voucher creation.

  • Fix validation of voucher name and code when child codes exist.

  • Set max_length to 128 on name field of voucher form, to match model.

0.3.0

  • Makes it possible to selectively apply offers to specific groups of users (using django.auth.contrib.models.Group).

  • Adds custom dashboard screens for managing offer / voucher benefits.

0.2.2

  • Fix bug preventing Voucher.groups form field from being blank

0.2.1

  • Fix bug the excluded templates from package.

0.2.0

  • Renamed package to oscarbluelight to have consistent naming with other Oscar projects.

0.1.1

  • Fix bug the excluded templates from package.

0.1.0

  • Initial release.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

django-oscar-bluelight-0.6.0.tar.gz (50.5 kB view details)

Uploaded Source

Built Distribution

django_oscar_bluelight-0.6.0-py3-none-any.whl (89.1 kB view details)

Uploaded Python 3

File details

Details for the file django-oscar-bluelight-0.6.0.tar.gz.

File metadata

File hashes

Hashes for django-oscar-bluelight-0.6.0.tar.gz
Algorithm Hash digest
SHA256 8881b36f2a9f0a24937aa85b65d4bcb97f7612c322c2474de946ba2f03b7a249
MD5 3b1a231ef0517de1bced837e67b0f157
BLAKE2b-256 7e9d72fb4ce4e4bbe9c8da6c281d2c8a1b97c485ec715a0e0671ad966904c554

See more details on using hashes here.

File details

Details for the file django_oscar_bluelight-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_oscar_bluelight-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2698cbbdf81598f8ba69e488358c7f30e186db9297b3248be3cf2be4dbe1dbbf
MD5 a568bebc48017797afc0e6b96a9ce188
BLAKE2b-256 892d7fa5f0c65370b0aaadaf03e313740ab10d573b50fff0348b7b67e7209988

See more details on using hashes here.

Supported by

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