You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

v0.6.rst 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. =======================
  2. Oscar 0.6 release notes
  3. =======================
  4. Welcome to Oscar 0.6!
  5. These release notes cover the `new features`_ as well as `backwards incompatible changes`_
  6. that you'll want to be aware of when upgrading from Oscar 0.5 or
  7. earlier. This release contains some major changes to core APIs which means
  8. many old APIs are to be dropped - see the `deprecation plan`_ to avoid any
  9. nasty surprises.
  10. To upgrade your Oscar site, make sure you study both the `backwards incompatible changes`_
  11. and the `deprecated features`_. If you have any undocumented issues, please
  12. let us know on the mailing list.
  13. .. _`new features`: `What's new in Oscar 0.6?`_
  14. .. _`upgrading advice`: `Upgrading notes`_
  15. .. _`deprecation plan`: `Features deprecated in 0.6`_
  16. .. _`deprecated features`: `Features deprecated in 0.6`_
  17. .. _`backwards incompatible changes`: `Backwards incompatible changes in 0.6`_
  18. Overview
  19. ========
  20. The biggest change in Oscar 0.6 is the reworking of `pricing and availability`_, which
  21. builds on top of the change to allow `multiple stockrecords per product`_. The
  22. change is largely backwards compatible with the old system of "partner
  23. wrappers" but it is recommended to upgrade to the new system. Support for
  24. partner wrappers will be removed for Oscar 0.7.
  25. Oscar 0.6 also introduces better support for marketplace-like functionality
  26. with the so-called permission-based dashboard. It is now possible to give
  27. non-staff users access to a subset of the dashboard's views (products and
  28. orders) by setting the new ``dashboard_access`` permission.
  29. `Oscar now supports Django 1.5`_ and its custom user model. This has been only
  30. tested in the context of starting a new Oscar project with a custom model.
  31. Switching from a separate "profile" model to the new system is not recommended
  32. at this point.
  33. Other notable new features include:
  34. * A feature-rich `demo site`_ that illustrates how Oscar can be customised. It
  35. uses several of Oscar's many extensions, such as django-oscar-paypal_,
  36. django-oscar-datacash_ and django-oscar-stores_. It is intended as a
  37. reference site for Oscar.
  38. * `Partners can now have addresses`_.
  39. * `Customer wishlists`_
  40. * `New helper methods`_ in the ``EventHandler`` class for order processing.
  41. * `Reworked search app`_ with support for easy faceting.
  42. Also, to help justify Tangent's sponsorship of Oscar,
  43. a simple `tracking mechanism`_ has been introduced.
  44. .. _`Oscar now supports Django 1.5`: `django_support`_
  45. .. _`Partners can now have addresses`: `Partner addresses`_
  46. .. _`Customer wishlists`: `Wishlists`_
  47. .. _`New helper methods`: `Order processing changes`_
  48. .. _`tracking mechanism`: `Tracking Oscar sites`_
  49. What's new in Oscar 0.6?
  50. ========================
  51. Multiple stockrecords per product
  52. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  53. Products can now have multiple stockrecords rather than just one. This allows a
  54. product to be fulfilled by one of several partners. This is a key requirement
  55. for large-scale e-commerce sites selling millions of products, that use many
  56. different fulfillment partners. It also allows products to be sold in
  57. different currencies.
  58. This changes means several APIs are `deprecated`_ as they assume there is only
  59. one stockrecord per product.
  60. .. _`deprecated`: `Features deprecated in 0.6`_
  61. Pricing and availability
  62. ~~~~~~~~~~~~~~~~~~~~~~~~
  63. When products can have many stockrecords, a process needs to be in place to
  64. choose which one is selected for a given customer and product. To handle this,
  65. a new "strategy" class has been introduced which selects the appropriate
  66. stockrecord for a given customer and product.
  67. This change also paved the way for reworking how prices, taxes and availability
  68. are handled. Instead of using `"partner wrappers"`_, the strategy class is
  69. responsible for returning availability details and prices for a particular
  70. product. New classes known as pricing and availabiliy policies are used to
  71. encapsulate this information.
  72. These changes allows Oscar to dynamically choose which stockrecord to use for a
  73. given customer and product. This enables several advanced features such as:
  74. * Fulfilling a product from the partner that offers the best margin.
  75. * Fulfilling a product from the partner geographically closest to the customer.
  76. * Supporting transactions in multiple currencies on the same site.
  77. * Supporting different tax treatments on the same site (eg UK VAT and US sales
  78. tax)
  79. * Having different pricing policies for different customers.
  80. It also provides a customisation layer for custom price and availability logic.
  81. There's a great deal of flexibility. See the guide to
  82. :doc:`prices and availability </topics/prices_and_availability>`
  83. for more information.
  84. Note that the :func:`oscar.templatetags.currency_filters.currency` now
  85. accepts an optional currency parameter.
  86. Permission-based dashboard
  87. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  88. Three changes were necessary to better support marketplace scenarios within
  89. Oscar:
  90. * Oscar's core :class:`oscar.core.application.Application` class now supports
  91. specifying permissions on a per-view basis. This is done via a new default
  92. decorator. Legacy behaviour is unchanged.
  93. * The dashboard's menu's are now built dynamically. If the current user does
  94. not have access to some views in :ref:`OSCAR_DASHBOARD_NAVIGATION`, they will
  95. be omitted in the menu returned by
  96. :meth:`oscar.apps.dashboard.nav.create_menu`.
  97. * The index, catalogue and order dashboard views have been modified to allow
  98. access to non-staff users. See :doc:`/ref/apps/dashboard` for details.
  99. * :attr:`oscar.apps.partner.abstract_models.AbstractPartner.users` was not
  100. used by core Oscar prior 0.6. It is now used to model access for the
  101. permission-based dashboard.
  102. Payment models have abstract versions
  103. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  104. The :doc:`payment models </ref/apps/payment>` have been split into abstract and
  105. concrete versions. This brings them inline with other Oscar apps and allows
  106. them to be customised.
  107. Wishlists
  108. ~~~~~~~~~
  109. Wishlist functionality has finally landed. Signed in customers are now able to
  110. create multiple named wishlists and add products to them. There is a new
  111. section in the customer's account where wishlists can be managed.
  112. Partner dashboard & addresses
  113. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  114. Partners can now have addresses. These are useful for US sales tax where tax
  115. calculations need to know the origin of a product being shipped.
  116. A dashboard to handle partners, their users and addresses has been added.
  117. Checkout
  118. ~~~~~~~~
  119. The :class:`~oscar.apps.checkout.views.PaymentDetailsView` checkout view has
  120. been restructured slightly to be more flexible. There is a new
  121. ``build_submission`` method which is responsible for building a dict of all data
  122. for passing to the ``submit`` method. This includes the shipping address and
  123. shipping method which were previously loaded indirectly within the ``submit``
  124. method. The ``submit`` method has also been extended to take additional parameters.
  125. Demo site
  126. ~~~~~~~~~
  127. Oscar now ships with a demo site along side the sandbox site. While the sandbox
  128. is a minimal Django project that uses Oscar with all its defaults, the demo site
  129. is a more realistic example of an Oscar project. It has a custom skin and makes
  130. many alterations to the default Oscar behaviour.
  131. It's features include:
  132. * A range of different product types: books, downloads, clothing
  133. * PayPal Express integration using django-oscar-paypal_
  134. * Datacash integration using django-oscar-datacash_
  135. .. _django-oscar-paypal: https://github.com/tangentlabs/django-oscar-paypal
  136. .. _django-oscar-datacash: https://github.com/tangentlabs/django-oscar-datacash
  137. .. _django-oscar-stores: https://github.com/tangentlabs/django-oscar-stores
  138. Further reading:
  139. * :doc:`The demo site </internals/sandbox>`.
  140. .. _django_support:
  141. Django 1.5, 1.6 and custom user model support
  142. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  143. Oscar now supports Django 1.5 and 1.6.
  144. Specifically, Oscar supports `custom user models`_, the headline new feature in Django
  145. 1.5. These can be used standalone or with a one-to-one profile model: Oscar's
  146. account forms inspect the model fields to dynamically pick up the fields for
  147. editing and display.
  148. There are some restrictions on what fields a custom user model must have. For
  149. instance, Oscar's default auth backend requires the user model to have an email
  150. and password field. New Oscar projects are encouraged to use the provided
  151. abstract user model as the base for their users.
  152. Further reading:
  153. * :doc:`How to use a custom user model </howto/use_a_custom_user_model>`.
  154. .. _`custom user models`: https://docs.djangoproject.com/en/dev/topics/auth/customizing/#specifying-a-custom-user-model
  155. .. _`documentation on user models`: https://docs.djangoproject.com/en/dev/topics/auth/customizing/#specifying-a-custom-user-model
  156. Accounts
  157. ~~~~~~~~
  158. The views and templates of the accounts section have been reworked to be clearer
  159. and easier to extend.
  160. Bootstrap-WYSIHTML5 replaced by TinyMCE
  161. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  162. TinyMCE 4.0 is now used in the dashboard for all textareas with class
  163. ``wysiwyg``. This has better browser support and is easier to customise than
  164. bootstrap-wysihtml5.
  165. It is easy to configure or replace with the HTML editor of your choice.
  166. Better bankcard handling
  167. ~~~~~~~~~~~~~~~~~~~~~~~~
  168. The bankcard model in the payment app has been greatly improved.
  169. Customer-facing range pages
  170. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  171. Ranges can now be flagged as public which means they can be browsed by
  172. customers. They can be used to created curated collections of products.
  173. Products can be manually reordered to display products in the specific
  174. order to customers.
  175. The core :class:`~oscar.apps.offer.models.Range` model has been extended with a
  176. HTML description field also.
  177. Reworked search app
  178. ~~~~~~~~~~~~~~~~~~~
  179. Oscar's search app has been reviewed and simplified. The main view class has
  180. been reworked to provide better support for faceting, which can be easily
  181. specified using the ``OSCAR_SEARCH_FACETS`` setting.
  182. The ``SuggestionsView`` has been removed as it wasn't being used. A later
  183. version of Oscar will include a replacement.
  184. Order processing changes
  185. ~~~~~~~~~~~~~~~~~~~~~~~~
  186. There are changes to order processing methods
  187. Tracking Oscar sites
  188. ~~~~~~~~~~~~~~~~~~~~
  189. Oscar's dashboard now serves a single pixel image from one of Tangent's
  190. servers. This is included to gather information on which sites use Oscar,
  191. which is an important metric for Tangent, who sponsor Oscar's development.
  192. It can easily be disabled by setting ``OSCAR_TRACKING=False``. If you do opt
  193. out, please email the mailing list with any production Oscar sites you are
  194. running. This will help to ensure investment in Oscar's future.
  195. Minor changes
  196. ~~~~~~~~~~~~~
  197. * detox_ is a new dependency, which allows running `tox` tests in parallel.
  198. .. _detox: https://pypi.python.org/pypi/detox
  199. * ``OSCAR_ALLOW_ANON_REVIEWS`` has been a documented setting since Oscar 0.4.
  200. But there's never been any code to support this, which has been rectified with
  201. this release. Things should now work as expected.
  202. * Oscar uses a cookie to display recently displayed products. This cookie never
  203. expired and wasn't a HttpOnly cookie. It is now a HttpOnly cookie and expires
  204. after 7 days. Additionally, two settings have been introduced to configure
  205. it analogues to the basket cookies:
  206. ``OSCAR_RECENTLY_VIEWED_COOKIE_LIFETIME`` and
  207. ``OSCAR_RECENTLY_VIEWED_COOKIE_NAME``.
  208. Backwards incompatible changes in 0.6
  209. =====================================
  210. Checkout
  211. ~~~~~~~~
  212. Several changes have been made to the checkout in the name of simplification
  213. and making things easier to customise.
  214. The ``PaymentDetailsView`` has been adjusted to explicitly pass variables
  215. around rather than relying on methods that load them on demand. This makes
  216. customisation easier.
  217. * The ``submit`` method in
  218. :class:`~oscar.apps.checkout.views.PaymentDetailsView` has a new signature.
  219. It now accepts the user, shipping address, shipping method and order total as
  220. required parameters The intention is that the ``build_submission`` methods
  221. returns a dict of kwargs for ``submit`` so that it can be called like::
  222. submission = self.build_submission()
  223. return self.submit(**submission)
  224. If your payment or order submission process requires additional parameters (eg
  225. a bankcard), override the ``build_submission`` method to provide them. The
  226. dict returns from the new ``build_submission`` method is also passed to the
  227. template.
  228. * The ``handle_payment`` method in
  229. :class:`~oscar.apps.checkout.views.PaymentDetailsView` now accepts a
  230. :class:`~oscar.core.prices.Price` instance instead of a Decimal for the order
  231. total.
  232. * The ``handle_order_placement`` method in
  233. :class:`~oscar.apps.checkout.mixins.OrderPlacementMixin`
  234. now accepts the user, shipping address and shipping method in a
  235. different order consistent with the ``submit`` method from
  236. ``PaymentDetailsView``.
  237. * The ``place_order`` method in
  238. :class:`~oscar.apps.checkout.mixins.OrderPlacementMixin`
  239. has a new signature. The parameters have been reordered and the shipping
  240. address, shipping method and billing address must be passed in explicitly (as
  241. unsaved instances).
  242. * The ``create_shipping_address`` method in
  243. :class:`~oscar.apps.checkout.mixins.OrderPlacementMixin` has changed
  244. signature. Instead of being passed a basket, it is now passed the user and
  245. an unsaved shipping address instance.
  246. * The ``create_billing_address`` method in
  247. :class:`~oscar.apps.checkout.mixins.OrderPlacementMixin` has changed
  248. signature. It is now passed an unsaved billing address instance as well as
  249. a shipping address instance.
  250. * The ``get_shipping_method`` (from
  251. :class:`~oscar.apps.checkout.session.CheckoutSessionMixin`) no longer
  252. defaults to returning free shipping if no shipping method can be looked up.
  253. * The :class:`~oscar.apps.checkout.calculators.OrderTotalCalculator` now
  254. returns a :class:`~oscar.core.prices.Price` instance from a new ``calculate``
  255. method. The old methods ``order_total_incl_tax`` and
  256. ``order_total_excl_tax`` have been removed.
  257. Signature changes
  258. ~~~~~~~~~~~~~~~~~
  259. Several classes and functions have had signature changes:
  260. * The ``basket_form`` templatetag has been altered to take the ``request`` as the
  261. first parameter, not ``request.basket``.
  262. * The :class:`oscar.apps.customer.forms.EmailAuthenticationForm` form needs to
  263. be instantated with a host name so prevent redirects to external sites.
  264. * The two product review forms, ``SignedInUserProductReviewForm`` and
  265. ``AnonymousUserProductReviewForm``, have been replaced by a new
  266. :class:`oscar.apps.catalogue.reviews.forms.ProductReviewForm`.
  267. * 3 properties have been removed from
  268. :class:`oscar.apps.catalogue.abstract_models.AbstractProductImage` as they
  269. were unused: ``resized_image_url``, ``fullsize_url`` and ``thumbnail_url``.
  270. Thumbnailing is instead achieved in templates with Sorl.
  271. Loading shipping methods
  272. ~~~~~~~~~~~~~~~~~~~~~~~~
  273. The default implementation of the shipping method repository has been adjusted
  274. to avoid thread-safety issues. If you define your own shipping ``Repository``
  275. class, ensure that your shipping methods are instantiated per-request and not
  276. at compile time.
  277. For example, avoid this:
  278. .. code-block:: python
  279. from oscar.apps.shipping import repository
  280. class Repository(repository.Repository)
  281. methods = [SomeMethod(), AnotherMethod()]
  282. Instead, instantiate the methods within ``get_shipping_methods``:
  283. .. code-block:: python
  284. from oscar.apps.shipping import repository
  285. class Repository(repository.Repository)
  286. # Note, methods are not instantiated
  287. methods = [SomeMethod, AnotherMethod]
  288. Beware of shipping methods that are configured via constructor parameters, like
  289. :class:`~oscar.apps.shipping.methods.FixedPrice`. Shipping methods will be
  290. reworked for Oscar 0.7.
  291. Basket model changes
  292. ~~~~~~~~~~~~~~~~~~~~~
  293. Several properties of the basket ``Line`` model have been renamed:
  294. * ``Line.line_price_excl_tax_and_discounts`` has been renamed to
  295. ``Line.line_price_excl_tax_incl_discounts``.
  296. * ``Line.line_price_incl_tax_and_discounts`` has been renamed to
  297. ``Line.line_price_incl_tax_incl_discounts``.
  298. Address model changes
  299. ~~~~~~~~~~~~~~~~~~~~~
  300. * The ``UserAddress.salutation`` and ``UserAddress.name`` methods are now
  301. properties.
  302. * The ``Country`` model's `is_highlighted` column is now an integer field to allow
  303. fine-grained country selection.
  304. Search app changes
  305. ~~~~~~~~~~~~~~~~~~
  306. Some of the names have been simplified.
  307. * The ``MultiFacetedSearchView`` and ``SuggestionsView`` view classes have been
  308. removed. The ``MultiFacetedSeachView`` class is replaced by ``FacetedSearchView``.
  309. * The ``MultiFacetedSearchForm`` has been removed in favour of
  310. ``SearchForm``.
  311. Range model changes
  312. ~~~~~~~~~~~~~~~~~~~
  313. ManyToManyField ``included_product`` of ``Range`` model was changed to use
  314. ``through`` relationship:
  315. * Use ``Range.add_product(product)`` instead of
  316. ``Range.included_product.add(product)``.
  317. * Use ``Range.remove_product(product)`` instead of
  318. ``Range.included_product.remove(product)``.
  319. When adding a product into a range, position in the range can be specified
  320. with ``display_order`` parameter:
  321. ``Range.add_product(product, display_order=3)``
  322. Renamed templates
  323. ~~~~~~~~~~~~~~~~~
  324. Some templates have been renamed for greater consistency. If you are overriding
  325. these templates, ensure you rename your corresponding project templates.
  326. Many of the profile templates have been reorganised:
  327. * ``customer/address_list.html`` is renamed to
  328. ``customer/address/address_list.html``
  329. * ``customer/address_form.html`` is renamed to
  330. ``customer/address/address_form.html``
  331. * ``customer/address_delete.html`` is renamed to
  332. ``customer/address/address_delete.html``
  333. * ``customer/email.html`` is renamed to
  334. ``customer/email/email_detail.html``
  335. * ``customer/email_list.html`` is renamed to
  336. ``customer/email/email_list.html``
  337. * ``customer/order.html`` is renamed to
  338. ``customer/order/order_detail.html``
  339. * ``customer/order_list.html`` is renamed to
  340. ``customer/order/order_list.html``
  341. * ``customer/profile.html`` is renamed to
  342. ``customer/profile/profile.html``
  343. * ``customer/profile_form.html`` is renamed to
  344. ``customer/profile/profile_form.html``
  345. * ``customer/change_password_form.html`` is renamed to
  346. ``customer/profile/change_password_form.html``
  347. * ``partials/nav_profile.html`` has been removed.
  348. Template block changes
  349. ~~~~~~~~~~~~~~~~~~~~~~
  350. * The template ``dashboard/orders/order_detail.html`` has been reorganised. The
  351. ``tab_transactions`` block has been renamed to ``payment_transactions``.
  352. * In ``checkout/checkout.html``, the ``checkout-nav`` block has been renamed
  353. ``checkout_nav``.
  354. Product model changes
  355. ~~~~~~~~~~~~~~~~~~~~~
  356. * The function ``add_category_from_breadcrumbs`` was not used and has been
  357. removed.
  358. Account templates
  359. ~~~~~~~~~~~~~~~~~
  360. The templates for the customer account section have been reworked so that the
  361. profile page is much simpler. Content is no longer loaded into tabs on a single
  362. page; instead, separate pages are used to each section.
  363. Additional apps
  364. ~~~~~~~~~~~~~~~
  365. Four new apps are required in your ``INSTALLED_APPS``:
  366. .. code-block:: python
  367. INSTALLED_APPS = (
  368. ...
  369. 'oscar.apps.wishlists',
  370. 'oscar.apps.dashboard.pages',
  371. 'oscar.apps.dashboard.partners',
  372. 'oscar.apps.dashboard.reviews',
  373. ...
  374. )
  375. If you are using the ``get_core_apps`` helper function, then these new apps
  376. will be added automatically. The new wishlists app contains database migrations,
  377. so you will need to run the ``migrate`` management command.
  378. Changes to Partner permissions
  379. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  380. The following permissions on the
  381. :class:`~oscar.apps.partner.abstract_models.AbstractPartner` model were not
  382. used in Oscar and have been removed to avoid confusion with the newly
  383. introduced permission-based dashboard:
  384. * ``can_edit_stock_records``
  385. * ``can_view_stock_records``
  386. * ``can_edit_product_range``
  387. * ``can_view_product_range``
  388. * ``can_edit_order_lines``
  389. * ``can_view_order_lines``
  390. The permission-based dashboard introduced a new permission:
  391. * ``dashboard_access``
  392. Upgrading notes
  393. ===============
  394. * Alternative product class templates now use ``slug`` field instead of
  395. ``name.lower()`` to determine their filename. If you have templates for
  396. specific product classes, please update your filenames accordingly
  397. Checkout app:
  398. * Checkout has a new option "Register and continue". Option value `new` in
  399. `GatewayForm` has changed to `guest` as `new` option is used for this feature.
  400. * Payment details - create_billing_address accepts kwargs so data can be passed
  401. to it from the final page of checkout.
  402. * The session methods for loading shipping addresses and methods have been made
  403. explicit. The relevant basket *has* to be passed in now.
  404. Payment app:
  405. * The `balance` method on the source object is now a property not a method.
  406. URLs
  407. ~~~~
  408. Migrations
  409. ~~~~~~~~~~
  410. There are new migrations in the following apps to be aware of.
  411. * Catalogue:
  412. - ``0011``: Higher ``max_length`` on FileFields and ImageFields
  413. * Promotions:
  414. - ``0003``: Higher ``max_length`` on FileFields and ImageFields
  415. * Address:
  416. - ``0003``: ``Country``'s ``is_highlighted`` is now an integer to allow
  417. finer control.
  418. * ShippingAddress:
  419. - ``0018``: ``ShippingAddress``'s ``phone_number`` is now a PhoneNumberField
  420. to allow fine validation.
  421. * Order app:
  422. - The `date` field of the ``order.AbstractCommunicationEvent``, ``order.AbstractPaymentEvent`` and
  423. ``order.AbstractShippingEvent`` models have been renamed to ``date_created`` for
  424. consistency with the rest of Oscar.
  425. Order app:
  426. * ``0015``: Unused ``sequence_number`` and ``is_required`` deleted from
  427. ``ShippingEventType``. Unused ``sequence_number`` deleted from
  428. ``PaymentEventType``.
  429. Offer app:
  430. * ``0021``: Add a ``slug`` field to the :class:`~oscar.apps.offer.models.Range` model.
  431. * ``0022``: A data migration to populate the new range slug field.
  432. * ``0023``: Add a ``is_public`` field to the :class:`~oscar.apps.offer.models.Range` model.
  433. * ``0024``: Add a ``description`` field to the :class:`~oscar.apps.offer.models.Range` model.
  434. Features deprecated in 0.6
  435. ==========================
  436. Accessing a product's stockrecords
  437. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  438. Several properties and methods of the core
  439. :class:`~oscar.apps.catalogue.abstract_models.AbstractProduct` class have been
  440. deprecated following the change to allow multiple stockrecords per product.
  441. * :attr:`~oscar.apps.catalogue.abstract_models.AbstractProduct.has_stockrecord`
  442. no longer makes sense when there can be more than one stockrecord. It is
  443. replaced by
  444. :attr:`~oscar.apps.catalogue.abstract_models.AbstractProduct.has_stockrecords`
  445. * :attr:`~oscar.apps.catalogue.abstract_models.AbstractProduct.stockrecord` is
  446. deprecated since it presumes there is only one stockrecord per product.
  447. Choosing the appropriate stockrecord is now the responsiblity of the
  448. :ref:`strategy class <strategy_class>`. A backward compatible version has
  449. been kept in place that selects the first stockrecord for a product. This
  450. will continue to work for sites that only have one stockrecord per product.
  451. All availability logic has been moved to :ref:`availability policies<availability_policies>`
  452. which are determined by the :ref:`strategy class <strategy_class>`.
  453. * :attr:`~oscar.apps.catalogue.abstract_models.AbstractProduct.is_available_to_buy`
  454. is deprecated. The functionality is now part of availability policies.
  455. * :meth:`~oscar.apps.catalogue.abstract_models.AbstractProduct.is_purchase_permitted`
  456. is deprecated. The functionality is now part of availability policies.
  457. Checkout session manager
  458. ~~~~~~~~~~~~~~~~~~~~~~~~
  459. The ``shipping_method`` method of the
  460. :class:`~oscar.apps.checkout.utils.CheckoutSessionData` is now deprecated in
  461. favour of using ``shipping_method_code``. It is being removed as the
  462. ``CheckoutSessionData`` class should only be responsible for retriving data
  463. from the session, not loading shipping method instances.
  464. Checkout order placement mixin
  465. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  466. The following methods within
  467. :class:`~oscar.apps.checkout.mixins.OrderPlacementMixin` are deprecated:
  468. * :meth:`~oscar.apps.checkout.mixins.OrderPlacementMixin.create_shipping_address_from_form_fields`
  469. * :meth:`~oscar.apps.checkout.mixins.OrderPlacementMixin.create_shipping_address_from_user_address`
  470. * :meth:`~oscar.apps.checkout.mixins.OrderPlacementMixin.create_user_address`
  471. "Partner wrappers"
  472. ~~~~~~~~~~~~~~~~~~
  473. Before Oscar 0.6, availability and pricing logic was encapsulated in "partner
  474. wrappers". A partner wrapper was a class that provided availability and price
  475. information for a particular partner, as specified by the
  476. ``OSCAR_PARTNER_WRAPPERS`` setting. The stockrecord model had several
  477. properties and methods
  478. which delegated to the appropriate wrapper for the record's partner.
  479. This functionailty is now deprecated in favour of using :ref:`strategy classes <strategy_class>`.
  480. How prices and taxes are determined is not generally a function of the partner,
  481. and so this system was not a good model. Strategy classes are much more
  482. flexible and allow better modelling of taxes and availability.
  483. The following attributes and methods from :class:`~oscar.apps.partner.abstract_models.StockRecord`
  484. are deprecated and will be removed for Oscar 0.7.
  485. * :attr:`AbstractStockRecord.is_available_to_buy <oscar.apps.partner.abstract_models.AbstractStockRecord.is_available_to_buy>`
  486. * :meth:`AbstractStockRecord.is_purchase_permitted <oscar.apps.partner.abstract_models.AbstractStockRecord.is_purchase_permitted>`
  487. * :attr:`AbstractStockRecord.availability_code <oscar.apps.partner.abstract_models.AbstractStockRecord.availability_code>`
  488. * :attr:`AbstractStockRecord.availability <oscar.apps.partner.abstract_models.AbstractStockRecord.availability>`
  489. * :attr:`AbstractStockRecord.max_purchase_quantity <oscar.apps.partner.abstract_models.AbstractStockRecord.max_purchase_quantity>`
  490. * :attr:`AbstractStockRecord.dispatch_date <oscar.apps.partner.abstract_models.AbstractStockRecord.dispatch_date>`
  491. * :attr:`AbstractStockRecord.lead_time <oscar.apps.partner.abstract_models.AbstractStockRecord.lead_time>`
  492. * :attr:`AbstractStockRecord.price_incl_tax <oscar.apps.partner.abstract_models.AbstractStockRecord.price_incl_tax>`
  493. * :attr:`AbstractStockRecord.price_tax <oscar.apps.partner.abstract_models.AbstractStockRecord.price_tax>`
  494. All the above properties and methods have effectively been moved to the availability and pricing
  495. policies that a strategy class is responsible for loading. To upgrade your
  496. codebase, replace your partner wrapper classes with equivalent
  497. :doc:`availability and pricing policies </topics/prices_and_availability>`.
  498. Basket
  499. ~~~~~~~
  500. Now that products can have multiple stockrecords, several changes have been made
  501. to baskets to allow the appropriate stockrecord to be tracked for each basket
  502. line. The basket line model has a new field that links to the selected
  503. stockrecord and the basket itself requires an instance of the strategy class so
  504. that prices can be calculated for each line. Hence, if you are manipulating
  505. baskets directly, you need to assign a strategy class in order for prices to
  506. calculate correctly:
  507. .. code-block:: python
  508. from oscar.apps.basket import models
  509. basket = models.Basket.objects.get(id=1)
  510. basket.strategy = request.strategy
  511. Without an assigned strategy class, a basket will raise a ``RuntimeError`` when
  512. attempting to calculate totals.
  513. The way a product is added to a basket has also been changed as a ``StockInfo``
  514. instance is also required.
  515. .. code-block:: python
  516. from oscar.apps.basket import models
  517. from oscar.apps.catalogue import models as product_models
  518. basket = models.Basket.objects.get(id=1)
  519. basket.strategy = request.strategy
  520. product = product_models.Product.objects.get(id=1)
  521. stockinfo = request.strategy.fetch(product)
  522. basket.
  523. Test support extension brought back into core
  524. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  525. The `Oscar test support library`_ has been ported back into Oscar core. This
  526. simplifies things and avoids circular dependency issues. If your project is
  527. using this extension, you should remove it as a dependency and use the
  528. analogous functionality from ``oscar/test/``.
  529. .. _`Oscar test support library`: https://github.com/tangentlabs/django-oscar-testsupport