Skip to main content

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

Project description

Django Oscar Bluelight Specials

license kit format

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


  • 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.


  • 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.


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.


Install [django-oscar-bluelight]{.title-ref}.:

pip install django-oscar-bluelight

Import Bluelight's settings into your projects file.

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

Add Bluelight to your installed apps (replacing the equivalent Django Oscar apps). The top-level oscarbluelight app must be defined before the oscar app---if it isn't Django will not correctly find the Bluelight's templates.

    # Bluelight. Must come before `django-oscar` so that template inheritance / overrides work correctly.

    # django-oscar
    'sandbox.partner',  # 'oscar.apps.partner',
    'sandbox.basket',  # 'oscar.apps.basket',
    'oscarbluelight.offer',  # 'oscar.apps.offer',
    'oscarbluelight.voucher',  # 'oscar.apps.voucher',
    'oscarbluelight.dashboard.offers',  # 'oscar.apps.dashboard.offers',
    'oscarbluelight.dashboard.vouchers',  # 'oscar.apps.dashboard.vouchers',

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):

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


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



  • Add new max_discount field to Benefit models, to allow capping the total discount granted by a benefit within a single application. Primary intended use case is for capping the discount granted by a compound benefits, when its child benefits could, in some product combinations, exceed the desired discount.
  • Convert README from reStructuredText to Markdown.
  • Fix performance issues related to vouchers with large numbers if children.


  • Remove duplicate offer_type field from offer form.


  • Oscar 3.1 compatibility
  • Drops Oscar 3.0 compatibility (due to 3.1's significant changes to offers / vouchers).
  • Fix bug in Offer Restrictions form which always reset voucher-type offers to site-type offers.
  • Add new "Fixed Price Per Item" benefit type


  • Add new dashboard view to view and delete voucher child codes.
  • Tweak voucher form to allow creating custom child codes on initial voucher creation.


  • Oscar 3.0 Compatibility
  • Add checkbox for excluding offer from cosmetic pricing


  • Improve performance of the "Add Products to Range" functionality in the dashboard by utilizing batch inserts.


  • Use Postgres materialized views to improve performance of querying for products in a range.


  • Support django-oscar 2.1


  • Add improved reporting formats for offers and vouchers.


  • Fix bug in CompoundBenefit which caused lines to not be properly consumed by a condition if the last-to-be-applied child benefit didn't trigger a discount.


  • Add support for django-oscar 2.x.
  • Drop support for django-oscar 1.x.


  • Internationalization
  • Feature: Compound Benefits. Allows applying more than one benefit with a single offer.
  • Improve performance of Range.contains_product by utilizing Redis SETs. Requires Redis caching on the Django site


  • Improve UI of the offer group dashboard view.
  • Improve checkout performance by tuning the update query in Offer.record_usage.
  • Alter behavior of MultibuyDiscountBenefit. Not discounts the second-most expensive product, rather than the cheapest product.
  • Remove now-unused cosmetic-pricing settings.


  • Fix bug with effective price.


  • Add support for adding images to Offers and Vouchers.
  • Add support for Python 3.7.
  • Add support for Django 2.1.


  • Add flag to offer result objects to allow flagging a result as hidden in the UI. Doesn't functionally affect anything other than adding the boolean flag property.
  • Bugfix for clearing products from range cache


  • Add support for Oscar 1.6 and Django 2.0.
    • Due to the write of the offer's system in Oscar 1.6, this release drops support for Oscar 1.5.


  • Fix exception thrown when editing a voucher
  • Fix broken Webpack build


  • Improve performance of offer application by caching the results of Range.contains_product and Range.contains.


  • Improve performance of cosmetic price application by using select_related.


  • Fix Django 2.0 Deprecation warnings.


  • Fix bug preventing saving an Offer's short name in the dashboard.


  • Fix method signature bug in several shipping benefits.


  • Adds support for Django 1.11 and Oscar 1.5


  • Add Concept of System Offer Groups.
    • System Offer Groups are standard offer groups, but are automatically created and are ensured to always exist. They can not, therefore, be created or deleted via the dashboard UI. They are lazy-created by referencing them in code using the oscarbluelight.offer.groups.register_system_offer_group(slug='foo') function. - Along with this functionality comes the addition of offer and group related signals which can be used to perform actions at specific points in time during offer group application. For example you could create a system offer group for offers which should be applied only after taxes have been calculated. Then you could use the pre_offer_group_apply signal to perform tax calculation on a basket directly before the offer group is applied.


  • Fix exception in dashboard when adding compound conditions


  • Fix bug related to conditions consuming basket lines when the condition range differed from the benefit range.
  • Run model validation before applying benefits to a basket. Results in better error reporting of invalid but difficult to enforce data.
  • Start to rebuild OfferGroup dashboard view as a React application.
    • Currently just recreates existing functionality using React and an API endpoint. - Next release will include drag-and-drop priority sorting of offers, vouchers, and offer groups.


  • Drop Django 1.9 support.
  • In offer group list, dim inactive offers and vouchers.
  • List related vouchers on benefit and condition edit pages.
  • Limit orders displayed on voucher stats.
  • Start testing against Django 1.11 and Oscar 1.5rc1:
    • Fix issue with Voucher ordering when doing a select_for_update. - Fix Oscar 1.5 issue with conditionaloffer_set vs offers related name. - Fix Oscar 1.5 issue with basket.Line.line_tax. - Upgrade sandbox to Oscar 1.5.
  • Add new field to ConditionalOffer: short_name
  • Make OfferApplications ordered


  • 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.


  • Improve unit testing with tox.


  • Upgrade test dependencies.


  • Upgraded to versiontag 1.2.0.


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


  • 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.


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


  • 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.


  • 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.


  • 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.


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


  • Fix bug the excluded templates from package.


  • Renamed package to [oscarbluelight]{.title-ref} to have consistent naming with other Oscar projects.


  • Fix bug the excluded templates from package.


  • 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.

Files for django-oscar-bluelight, version 5.1.0
Filename, size File type Python version Upload date Hashes
Filename, size django_oscar_bluelight-5.1.0-py3-none-any.whl (538.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-oscar-bluelight-5.1.0.tar.gz (474.1 kB) File type Source Python version None Upload date Hashes View

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