Oscar 3.0 release notes¶
Welcome to Oscar 3.0!
This is a significant release, in which all of Oscar’s core templates and styles have been ported to Bootstrap 4. Support for Bootstrap 3 has been dropped, and projects that upgrade to Oscar 3 will also need to upgrade their frontend and dashboard templates to use Bootstrap 4.
Oscar 3.0 is compatible with Django 2.2, Django 3.0 and Django 3.1 as well as Python 3.6, 3.7 and 3.8.
Support for Django 1.11 and Django 2.1 has been dropped. Support for Python 3.5 has been dropped.
What’s new in Oscar 3.0?¶
Oscar 3.0 features a major upgrade of Oscar’s default templates and styles to use Bootstrap version 4.5. Both the front-end and dashboard templates have been refactored to work with Bootstrap 4. This is a major, non-backward compatible change for projects that rely on or extend the default Oscar templates.
The Bootstrap 4 migration guide is a helpful resource for migration from version 3.
As with Bootstrap 4 itself, Oscar’s default styles are now defined using SASS instead of LESS.
To replace Bootstrap 3’s Glyphicons, Oscar’s default templates now rely on Font Awesome.
Support was added to the
catalogue.Optionmodel to define the type of option. This is used by the
AddToBasketFormto determine the appropriate form field to display for that option in the add-to-cart form. Currently supported types are: text, integer, float, boolean, and date.
typefield on the
Optionmodel (previously used to denote whether the option is required) has been repurposed to store the type of the option, and a new
requiredfield has been added to denote whether the option is required. Projects that have forked the catalogue app will need to generate custom migrations for these model field changes. Projects should pay close attention to the data migration provided in
catalogue/migrations/0019_option_required.pyfor this change.
Added support for restricted combinations of offers. When creating an offer in the dashboard, administrators can now define a restricted set of other offers that offer can be used in combination with. This changes introduces a new
combinationsfield on the
Offermodel which requires a database migration.
ReportGeneratorclass has been refactored to make it easier to use. Subclasses must now define either a
querysetto indicate which model/queryset the report generator should use, or alternatively override the
get_queryset()method. Failure to do one of these will result in an exception.
Filtering by date range is now properly applied during CSV export of reports.
meta_descriptionhave been added to both the
Categorymodels, which can be used to override the HTML title and meta description content for product and category pages. These are editable from the search engine optimisation tab in the dashboard edit views for products and categories respectively. A database migration is required for this change.
Backwards incompatible changes¶
StockRecord.price_excl_taxfield has been renamed to
StockRecord.price. Projects that have forked the
partnerapp will need to generate their own migration to rename this field.
annotate_form_fieldtemplate tag will now set the
widget_typein the format used by Django 3.1: so no longer
CheckboxInput, but just
The signature of the
Benefithas changed to accept an optional
currencyargument, which is now supplied when calling those methods. This allows currency-aware determination of shipping discounts.
The signature of the
Benefit.roundmethod has changed to accept an optional
currencyargument, which is now supplied when calling those methods. The currency is also passed to any custom rounding function that is defined using
OSCAR_OFFER_ROUNDING_FUNCTION. This allows currency-aware rounding.
catalogue.product_attributes.ProductAttributesContainerwas refactored to ensure that attributes inside the container are always properly loaded at initialisation. The container is now wrapped in a
SimpleLazyObjectwhen assigned to
ProductAttributesContainer.initiate_attributes()was removed as the database query now happens on instantiation.
Fixed the handling of multiple non-exclusive offers with a count condition (#3162).
Removal of deprecated features¶
Several deprecated model fields have been removed in Oscar 3.0:
Oscar ships with migrations that remove these fields. If you want to continue using them, please make sure you add the fields back to your forked app before migrating. Projects that have forked the
partnerapps will need to generate their own migrations to remove these fields.
customer.notifications.services.notify_usershave been removed. Use
customer.alerts.utils.send_product_alertshave been removed. Use
Notificationmodels that moved from the
customerapp to the
communicationapp in Oscar 2.1 can no longer be dynamically loaded from their old paths.
Several models were updated to define a default ordering, to avoid issues with inconsistent ordering of items in the dashboard and elsewhere. Database migrations are required for these changes. Models affected are:
Database indexes were added to several model fields to improve query efficiency. Affected fields are:
Category slugs can now be edited via the dashboard.
A new method
get_attribute_values()was added to the Product model which returns a merged set of attribute values for child and parent products.
The behaviour of
checkout.views.ThankYouViewwhen no order is found in the session has changed, to redirect the user to the URL defined by
settings.OSCAR_HOMEPAGEinstead of returning a page not found error.
Python package dependencies:
django-tables2to version 2.3.
bootstrapto version 4.5.3.
tempusdominus-bootstrap-4version 5.1, use for Bootstrap 4 datepicker inputs.
tinymceto version 5.6.
catalogue.Option.is_requiredis deprecated. Check