Oscar 0.7 release notes

release

2014-04-29

Welcome to Oscar 0.7!

These release notes cover the new features as well as backwards incompatible changes that you’ll want to be aware of when upgrading from Oscar 0.6 or earlier.

If you encounter any undocumented issues, please let us know on the mailing list.

Table of contents:

Overview

Oscar 0.7 is largely a maintenance release, fixing minor issues, merging long-standing pull requests and other housekeeping.

As part of the clean-up, we have removed a few unused models and model fields, as well as removing null=True from a load of CharFields - so please read the release notes carefully when upgrading as some schema migrations may need some care.

Further, ensure you test your checkout implementation carefully after upgrading as the core Oscar checkout view classes have been reorganised slightly. Any upgrading work should be minor but be diligent.

Compatibility

Oscar 0.7 has experimental support for Python 3.

Support for Django 1.4 has been dropped, and support for Django 1.6 is now considered stable.

What’s new in Oscar 0.7?

Search improvements

Several improvements have been made to Oscar’s default search functionality:

  • Search results can be now be sorted.

  • If your search backend supports it, spelling suggestions will be shown if the original search term doesn’t lead to any results.

  • Only products are returned by the core search view. Other content types in your search index are filtered out (#370).

Extended signals

Oscar’s signals have been improved and consolidated, making it easier to hook into user journeys and extract analytics information.

Changes to existing signals include:

New signals:

  • A start_checkout signal is now raised when the customer begins the checkout process.

See the signals docs for more details.

Checkout reorganisation

The checkout classes have been reworked to clean-up how pre-conditions are enforced. Each view class now has a pre_conditions attribute which is an iterable of method names (as strings). Each method is run within the dispatch method of the view and will redirect the customer back to the appropriate view if the check fails.

This change makes pre-conditions easier to customise and simplifies the core checkout views. Consequently, the following methods are no longer required and have been removed:

  • PaymentDetails.get_error_response

  • PaymentDetails.can_basket_be_submitted

Further, the PaymentDetailsView has been re-organised for extensibility. For instance, several new methods have been introduced to allow fine-grained overriding of functionality:

The implementation of submit() has been improved to handle payment errors in a more customer friendly way. If an exception is raised during payment, the payment details page is now loaded with the original forms passed to the template (so form validation errors can be displayed).

Finally, the billing_address kwarg to submit`() has been removed. If you want to pass a billing address to be saved against the order, then pass it as part of the order_kwargs option.

Minor changes

  • Oscar’s LESS files now use Bootstrap 2.3.2 (Oscar 0.6 uses 2.1.1).

  • The product model now has a num_approved_reviews property to avoid unnecessary SQL queries when rendering templates (#1299)

  • Customers can delete their profiles from within their account section.

  • Customers are prevented from using short or common passwords when changing their password in their account (#1202)

  • permissions_map now supports more than two lists to evaluate permissions.

  • Formset handling in ProductCreateUpdateView has been simplified and now easily allows adding further formsets.

  • Increased required version of Django Haystack to 2.1

  • The dashboard’s Bootstrap and the Bootstrap JS has been bumped to 2.3.2, the latest release of version 2.

  • The dashboard’s category handling now has the ability to directly create child categories.

  • Oscar’s error messages now have their own CSS class, error-block (ef3ccf08a7).

  • It is now possible to disable the redirect that happens when a product or category’s slug changed and an old URL is used (b920f8ba).

  • BankCardNumberField now allows specifying accepted card types (32b7249).

  • Several slug fields have been turned into the newly introduced AutoSlugField to ensure that generated slugs are unique.

  • Widget initialisation can now be prevented with adding the no-widget-init class. Issues around widget initialisation in the dashboard promotions have been resolved.

  • The access function used to determine dashboard’s menu entries’ visibility is now settable via OSCAR_DASHBOARD_DEFAULT_ACCESS_FUNCTION.

  • Vouchers start and end times now use datetime instead of date; allowing “lunch-time deals” etc.

  • Product classes can now be added from the dashboard. Editing options and attributes is not yet supported though.

  • Experimental support for having a language prefix in the URL has been added, and enabled for the sandbox. This can be achieved by using Django’s i18n_patterns function in your urls.py. for the sandbox. See sandbox/urls.py for an example.

  • A basic example for a multi-language sitemap has been added to the sandbox.

  • Reasoning about e.g. when it is feasible to drop Python 2.6 or Django 1.5 support is hard without reliable data, hence the tracker pixel has been extended to submit the Python and Django version in use. Tracking is still easily disabled by setting OSCAR_TRACKING to False.

Bug fixes

  • Addresses in non-shipping countries can no longer be selected as default shipping address anymore (be04d46639).

  • Suspended and consumed offers are no longer returned by the “active” offer manager. (#1228).

  • Products can now be removed from categories (#1289).

Backwards incompatible changes in 0.7

Warning

Fields and models have been removed from Oscar. If you used them, you must ensure you create/extend the affected models appropriately.

  • Oscar has dropped support for Django 1.4. However, if Oscar continues to support the AUTH_PROFILE_MODULE setting so sites that use separate profile models aren’t forced to convert to a single user model in order to use Oscar 0.7.

  • AbstractProduct.status was an unused CharField provided for convenience as it’s a commonly required field. But a different field type was often required, and as changing it is much harder than adding a field with the desired type, the field has been removed.

  • Contributor, ContributorRole, the through-model ProductContributor and their abstract versions have been removed as they were unused and too specific to the domain of book shops.

  • ProductCategory.is_canonical was an unused BooleanField and has been removed.

  • Order.basket_id was a PositiveIntegerField containing the primary key of the associated basket. It’s been refactored to be a nullable ForeignKey and is now called “basket”.

  • #1123 - The URL structure of ProductCreateRedirectView has been changed to use the product class’ slug instead of the primary key. It’s necessary to update URLs pointing to that view.

  • ProductListView has been removed as it wasn’t needed any more after the search improvements. The old URL route still works.

  • Accessing categories by just slug instead of primary key and slug had been unofficially deprecated for 0.6, and is removed now.

  • #1251 - Form related templates have been refactored. If you’ve modified them, your templates might need updating.

  • django.conf.urls.i18n has been removed from Oscar’s default URLs. This is because to get i18n_patterns working for Oscar, it needs to be defined outside of the scope of it. If you use i18n, you need to explicitly add the following line to your main urls.py:

    (r'^i18n/', include('django.conf.urls.i18n')),
    
  • jScrollPane, which was used to style the dashboard’s scroll bars, has been removed.

  • The methods get_error_response and can_basket_be_submitted have been removed from the PaymentDetailsView view class in checkout

Removal of features deprecated in 0.6

  • Django 1.4 support has been removed.

  • In OrderPlacementMixin, the following methods have been removed:

    • create_shipping_address_from_form_fields - This is removed as checkout now requires an unsaved shipping address instance to be passed in (rather than having it created implicitly).

    • create_user_address - This is replaced by oscar.apps.checkout.mixin.OrderPlacementMixin.update_address_book().

    • create_shipping_address_from_user_address

  • The oscar.apps.checkout.session.CheckoutSessionData.shipping_method() has been removed. Instead oscar.apps.checkout.session.CheckoutSessionMixin.get_shipping_address() provides the same functionality.

Migrations

Warning

The reviews app has not been under migration control so far. Please ensure you follow South’s guidelines on how to convert an app. Essentially, you will have to run: $ ./manage.py migrate reviews 0001 --fake

Warning

A lot of Oscar apps have data migrations for CharFields before null=True is removed in the following schema migration. If you have extended such an app and use your own migrations, then you will need to first convert affected None’s to '' yourself; see the data migrations for our approach.

Note

Be sure to read the detailed instructions for handling migrations.

  • Address:

    • 0008 - Forgotten migration for UserAddress.phone_number

    • 0009 & 0010 - Data and schema migration for removing null=True on CharFields

  • Catalogue:

    • 0014 - Drops unused ProductCategory.is_canonical field.

    • 0015 - Turns a product’s UPC field into a oscar.models.fields.NullCharField

    • 0016 - AutoSlugField for AbstractProductClass and AbstractOption

    • 0017 - Removes Product.status, Contributor, ContributorRole and ProductContributor

    • 0018 - Set on_delete=models.PROTECT on Product.product_class

    • 0019 & 0020 - Data and schema migration for removing null=True on CharFields

  • Customer:

    • 0006 - AutoSlugField and unique=True for AbstractCommunicationEventType

    • 0007 & 0008 - Data and schema migration for removing null=True on CharFields

    • 0009 - Migration caused by CommunicationEventType.code separator change

  • Offer:

    • 0029 - AutoSlugField for ConditionalOffer

    • 0030 & 0031 - Data and schema migration for removing null=True on CharFields

    • 0032 - Changing proxy_class fields to NullCharField

  • Order:

    • 0025 - AutoSlugField for AbstractPaymentEventType and AbstractShippingEventType``

    • 0026 - Allow null=True and blank=True for Line.partner_name

    • 0027 & 0028 - Data and schema migration for removing null=True on CharFields

  • Partner:

    • 0011 - AutoSlugField for AbstractPartner

    • 0012 & 0013 - Data and schema migration for removing null=True on CharFields

  • Payment:

    • 0003 - AutoSlugField and unique=True for AbstractSourceType

  • Promotions:

    • 0004 & 0005 - Data and schema migration for removing null=True on CharFields

  • Shipping:

    • 0006 - AutoSlugField for ShippingMethod

  • Reviews:

    • 0001 - Initial migration for reviews application. Make sure to follow South’s guidelines on how to convert an app.

    • 0002 & 0003 - Data and schema migration for removing null=True on CharFields

  • Voucher:

    • 0002 and 0003 - Convert [start|end]_date to [start|end]_datetime (includes data migration).