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 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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`_.
  9. To upgrade your Oscar site, make sure you study both the `backwards incompatible changes`_
  10. and the `deprecated features`_
  11. .. _`new features`: `What's new in Oscar 0.6?`_
  12. .. _`upgrading advice`: `Upgrading`_
  13. .. _`deprecation plan`: `Features deprecated in 0.6`_
  14. .. _`deprecation features`: `Features deprecated in 0.6`_
  15. .. _`backwards incompatible changes`: `Backwards incompatible changes in 0.6`_
  16. Overview
  17. ========
  18. The biggest change in Oscar 0.6 is the reworking of `pricing and availability`_, which
  19. builds on top of the change to allow `multiple stockrecords per product`_. The
  20. charge is largely backwards compatible with the old system of "partner
  21. wrappers" but it is recommended to upgrade to the new system. Support for
  22. partner wrappers will be removed for Oscar 0.7.
  23. `Oscar now supports Django 1.5`_ and its custom user model. This has been only
  24. tested in the context of starting a new Oscar project with a custom model.
  25. Switching from a separate "profile" model to the new system is not recommended
  26. at this point.
  27. Other notable new features include:
  28. * A feature-rich `demo site`_ that illustrates how Oscar can be customised. It
  29. uses several of Oscar's many extensions, such as django-oscar-paypal_,
  30. django-oscar-datacash_ and django-oscar-stores_. It is intended as a
  31. reference site for Oscar.
  32. * `Partners can now have addresses`_.
  33. * `Customer wishlists`_
  34. * `New helper methods`_ in the ``EventHandler`` class for order processing
  35. .. _`Oscar now supports Django 1.5`: `Django 1.5 and customer user model support`_
  36. .. _`demo site`: `Demo site`_
  37. .. _`Partners can now have addresses`: `Partner addresses`_
  38. .. _`Customer wishlists`: `Wishlists`_
  39. .. _`New helper methods`: `Order processing changes`_
  40. What's new in Oscar 0.6?
  41. ========================
  42. Multiple stockrecords per product
  43. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  44. Products can now have multiple stockrecords rather than just one. This allows a
  45. product to be fulfilled by one of several partners. This is a key requirement
  46. for large-scale e-commerce sites selling millions of products, that use many
  47. different fulfillment partners. It also allows products to be sold in
  48. different currencies.
  49. This changes means several APIs are `deprecated`_ as they assume there is only
  50. one stockrecord per product.
  51. .. _`deprecated`: `Features deprecated in 0.6`_
  52. Pricing and availability
  53. ~~~~~~~~~~~~~~~~~~~~~~~~
  54. When products can have many stockrecords, a process needs to be in place to
  55. choose which one is selected for a given customer and product. To handle this,
  56. a new "strategy" class has been introduced which selects the appropriate
  57. stockrecord for a given customer and product.
  58. This change also paved the way for reworking how prices, taxes and availability
  59. are handled. Instead of using `"partner wrappers"`_, the strategy class is
  60. responsible for returning availability details and prices for a particular
  61. product. New classes known as pricing and availabiliy policies are used to
  62. encapsulate this information.
  63. These changes allows Oscar to dynamically choose which stockrecord to use for a
  64. given customer and product. This enables several advanced features such as:
  65. * Fulfilling a product from the partner that offers the best margin.
  66. * Fulfilling a product from the partner geographically closest to the customer.
  67. * Supporting transactions in multiple currencies on the same site.
  68. * Supporting different tax treatments on the same site (eg UK VAT and US sales
  69. tax)
  70. * Having different pricing policies for different customers.
  71. It also provides a customisation layer for custom price and availability logic.
  72. There's a great deal of flexibility. See the guide to
  73. :doc:`prices and availability </topics/prices_and_availability>`
  74. for more information.
  75. Payment models have abstract versions
  76. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  77. The :doc:`payment models </ref/apps/payment>` have been split into abstract- and
  78. concrete versions. This brings them inline with other Oscar apps and allows
  79. them to be customised.
  80. Wishlists
  81. ~~~~~~~~~
  82. Wishlist functionality has finally landed. Signed in customers are now able to
  83. create multiple named wishlists and add products to them. There is a new
  84. section in the customer's account where wishlists can be managed.
  85. Partner addresses
  86. ~~~~~~~~~~~~~~~~~
  87. Partners can now have addresses. These are useful for US sales tax where tax
  88. calculations need to know the origin of a product being shipped. The dashboard
  89. has been extended to allow partner addresses to be edited.
  90. Demo site
  91. ~~~~~~~~~
  92. Oscar now ships with a demo site along side the sandbox site. While the sandbox
  93. is a minimal Django project that uses Oscar with all its defaults, the demo site
  94. is a more realistic example of an Oscar project. It has a custom skin and makes
  95. many alterations to the default Oscar behaviour.
  96. It's features include:
  97. * A range of different product types: books, downloads, clothing
  98. * PayPal Express integration using django-oscar-paypal_
  99. * Datacash integration using django-oscar-datacash_
  100. .. _django-oscar-paypal: https://github.com/tangentlabs/django-oscar-paypal
  101. .. _django-oscar-datacash: https://github.com/tangentlabs/django-oscar-datacash
  102. .. _django-oscar-stores: https://github.com/tangentlabs/django-oscar-stores
  103. Further reading:
  104. * :doc:`The demo site </internals/sandbox>`.
  105. Django 1.5 and custom user model support
  106. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  107. Oscar now supports `custom user models`_, the headline new feature in Django
  108. 1.5. These can be used standalone or with a one-to-one profile model: Oscar's
  109. account forms inspect the model fields to dynamically pick up the fields for
  110. editing and display.
  111. There are some restrictions on what fields a custom user model must have. For
  112. instance, Oscar's default auth backend requires the user model to have an email
  113. and password field. New Oscar projects are encouraged to use the provided
  114. abstract user model as the base for their users.
  115. Further reading:
  116. * :doc:`How to use a custom user model </howto/use_a_custom_user_model>`.
  117. .. _`custom user models`: https://docs.djangoproject.com/en/dev/topics/auth/customizing/#specifying-a-custom-user-model
  118. .. _`documentation on user models`: https://docs.djangoproject.com/en/dev/topics/auth/customizing/#specifying-a-custom-user-model
  119. Accounts
  120. ~~~~~~~~
  121. The views and templates of the accounts section have been reworked to be clearer
  122. and easier to extend.
  123. Better bankcard handling
  124. ~~~~~~~~~~~~~~~~~~~~~~~~
  125. The bankcard model in the payment app has been greatly improved.
  126. Order processing changes
  127. ~~~~~~~~~~~~~~~~~~~~~~~~
  128. There are changes to order processing methods
  129. Minor changes
  130. ~~~~~~~~~~~~~
  131. * detox_ is a new dependency, which allows running `tox` tests in parallel.
  132. .. _detox: https://pypi.python.org/pypi/detox
  133. Backwards incompatible changes in 0.6
  134. =====================================
  135. Signature changes
  136. ~~~~~~~~~~~~~~~~~
  137. Several classes and functions have had signature changes:
  138. * The ``basket_form`` templatetag has been altered to take the ``request`` as the
  139. first argument, not ``request.basket``.
  140. * The :class:`oscar.apps.customer.forms.EmailAuthenticationForm` form needs to
  141. be instantated with a host name so prevent redirects to external sites.
  142. * The :class:`oscar.apps.customer.forms.EmailAuthenticationForm` form needs to
  143. be instantated with a host name so prevent redirects to external sites.
  144. * The two product review forms, ``SignedInUserProductReviewForm`` and
  145. ``AnonymousUserProductReviewForm``, have been replaced by a new
  146. :class:`oscar.apps.catalogue.reviews.forms.ProductReviewForm``.
  147. Address model changes
  148. ~~~~~~~~~~~~~~~~~~~~~
  149. * The ``UserAddress.salutation`` and ``UserAddress.name`` methods are now
  150. properties.
  151. * The ``Country`` model's `is_highlighted` column is now an integer field to allow
  152. fine-grained country selection.
  153. Renamed templates
  154. ~~~~~~~~~~~~~~~~~
  155. Some templates have been renamed for greater consistency. If you are overriding
  156. these templates, ensure you rename your corresponding project templates.
  157. Many of the profile templates have been reorganised:
  158. * ``customer/address_list.html`` is renamed to
  159. ``customer/address/address_list.html``
  160. * ``customer/address_form.html`` is renamed to
  161. ``customer/address/address_form.html``
  162. * ``customer/address_delete.html`` is renamed to
  163. ``customer/address/address_delete.html``
  164. * ``customer/email.html`` is renamed to
  165. ``customer/email/email_detail.html``
  166. * ``customer/email_list.html`` is renamed to
  167. ``customer/email/email_list.html``
  168. * ``customer/order.html`` is renamed to
  169. ``customer/order/order_detail.html``
  170. * ``customer/order_list.html`` is renamed to
  171. ``customer/order/order_list.html``
  172. * ``customer/profile.html`` is renamed to
  173. ``customer/profile/profile.html``
  174. * ``customer/profile_form.html`` is renamed to
  175. ``customer/profile/profile_form.html``
  176. * ``customer/change_password_form.html`` is renamed to
  177. ``customer/profile/change_password_form.html``
  178. * ``partials/nav_profile.html`` has been removed.
  179. Template block changes
  180. ~~~~~~~~~~~~~~~~~~~~~~
  181. * The template ``dashboard/orders/order_detail.html`` has been reorganised. The
  182. ``tab_transactions`` block has been renamed to ``payment_transactions``.
  183. * In ``checkout/checkout.html``, the ``checkout-nav`` block has been renamed
  184. ``checkout_nav``.
  185. Account templates
  186. ~~~~~~~~~~~~~~~~~
  187. The templates for the customer account section have been reworked so that the
  188. profile page is much simpler. Content is no longer loaded into tabs on a single
  189. page; instead, separate pages are used to each section.
  190. Upgrading notes
  191. ===============
  192. Database migrations
  193. ~~~~~~~~~~~~~~~~~~~
  194. * Alternative product class templates now use ``slug` field instead of
  195. ``name.lower()`` to determine their filename. If you have templates for
  196. specific product classes, please update your filenames accordingly
  197. Checkout app:
  198. * Checkout has a new option "Register and continue". Option value `new` in
  199. `GatewayForm` has changed to `guest` as `new` option is used for this feature.
  200. * Payment details - create_billing_address accepts kwargs so data can be passed
  201. to it from the final page of checkout.
  202. * The session methods for loading shipping addresses and methods have been made
  203. explicit. The relevant basket *has* to be passed in now.
  204. Payment app:
  205. * The `balance` method on the source object is not a property not a method.
  206. Order app:
  207. * ``0015``: Unused ``sequence_number`` and ``is_required`` deleted from
  208. ``ShippingEventType``. Unused ``sequence_number`` deleted from
  209. ``PaymentEventType``.
  210. URLs
  211. ~~~~
  212. Migrations
  213. ~~~~~~~~~~
  214. There are new migrations in the following apps to be aware of.
  215. * Catalogue:
  216. - ``0011``: Higher ``max_length`` on FileFields and ImageFields
  217. * Promotions:
  218. - ``0003``: Higher ``max_length`` on FileFields and ImageFields
  219. * Address:
  220. - ``0003``: ``Country``'s ``is_highlighted`` is now an integer to allow
  221. finer control.
  222. * Order app:
  223. - The `date` field of the ``order.AbstractCommunicationEvent``, ``order.AbstractPaymentEvent`` and
  224. ``order.AbstractShippingEvent`` models have been renamed to ``date_created`` for
  225. consistency with the rest of Oscar.
  226. Features deprecated in 0.6
  227. ==========================
  228. Accessing a product's stockrecords
  229. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  230. Several properties and methods of the core
  231. :class:`~oscar.apps.catalogue.abstract_models.AbstractProduct` class have been
  232. deprecated following the change to allow multiple stockrecords per product.
  233. * :attr:`~oscar.apps.catalogue.abstract_models.AbstractProduct.has_stockrecord`
  234. no longer makes sense when there can be more than one stockrecord. It is
  235. replaced by
  236. :attr:`~oscar.apps.catalogue.abstract_models.AbstractProduct.has_stockrecords`
  237. * :attr:`~oscar.apps.catalogue.abstract_models.AbstractProduct.stockrecord` is
  238. deprecated since it presumes there is only one stockrecord per product.
  239. Choosing the appropriate stockrecord is now the responsiblity of the
  240. :ref:`strategy class <strategy_class>`. A backward compatible version has
  241. been kept in place that selects the first stockrecord for a product. This
  242. will continue to work for sites that only have one stockrecord per product.
  243. All availability logic has been moved to :ref:`availability policies<availability_policies>`
  244. which are determined by the :ref:`strategy class <strategy_class>`.
  245. * :attr:`~oscar.apps.catalogue.abstract_models.AbstractProduct.is_available_to_buy`
  246. is deprecated. The functionality is now part of availability policies.
  247. * :meth:`~oscar.apps.catalogue.abstract_models.AbstractProduct.is_purchase_permitted`
  248. is deprecated. The functionality is now part of availability policies.
  249. "Partner wrappers"
  250. ~~~~~~~~~~~~~~~~~~
  251. Before Oscar 0.6, availability and pricing logic was encapsulated in "partner
  252. wrappers". A partner wrapper was a class that provided availability and price
  253. information for a particular partner, as specified by the
  254. ``OSCAR_PARTNER_WRAPPERS`` setting. The stockrecord model had several
  255. properties and methods
  256. which delegated to the appropriate wrapper for the record's partner.
  257. This functionailty is now deprecated in favour of using :ref:`strategy classes <strategy_class>`.
  258. How prices and taxes are determined is not generally a function of the partner,
  259. and so this system was not a good model. Strategy classes are much more
  260. flexible and allow better modelling of taxes and availability.
  261. The following attributes and methods from :class:`~oscar.apps.partner.abstract_models.StockRecord`
  262. are deprecated and will be removed for Oscar 0.7.
  263. * :attr:`AbstractStockRecord.is_available_to_buy <oscar.apps.partner.abstract_models.AbstractStockRecord.is_available_to_buy>`
  264. * :meth:`AbstractStockRecord.is_purchase_permitted <oscar.apps.partner.abstract_models.AbstractStockRecord.is_purchase_permitted>`
  265. * :attr:`AbstractStockRecord.availability_code <oscar.apps.partner.abstract_models.AbstractStockRecord.availability_code>`
  266. * :attr:`AbstractStockRecord.availability <oscar.apps.partner.abstract_models.AbstractStockRecord.availability>`
  267. * :attr:`AbstractStockRecord.max_purchase_quantity <oscar.apps.partner.abstract_models.AbstractStockRecord.max_purchase_quantity>`
  268. * :attr:`AbstractStockRecord.dispatch_date <oscar.apps.partner.abstract_models.AbstractStockRecord.dispatch_date>`
  269. * :attr:`AbstractStockRecord.lead_time <oscar.apps.partner.abstract_models.AbstractStockRecord.lead_time>`
  270. * :attr:`AbstractStockRecord.price_incl_tax <oscar.apps.partner.abstract_models.AbstractStockRecord.price_incl_tax>`
  271. * :attr:`AbstractStockRecord.price_tax <oscar.apps.partner.abstract_models.AbstractStockRecord.price_tax>`
  272. All the above properties and methods have effectively been moved to the availability and pricing
  273. policies that a strategy class is responsible for loading. To upgrade your
  274. codebase, replcae your partner wrapper classes with equivalent
  275. :doc:`availability and pricing policies </topics/prices_and_availability>`.
  276. Basket
  277. ~~~~~~~
  278. Now that products can have multiple stockrecords, several changes have been made
  279. to baskets to allow the appropriate stockrecord to be tracked for each basket
  280. line. The basket line model has a new field that links to the selected
  281. stockrecord and the basket itself requires an instance of the strategy class so
  282. that prices can be calculated for each line. Hence, if you are manipulating
  283. baskets directly, you need to assign a strategy class in order for prices to
  284. calculate correctly:
  285. .. code-block:: python
  286. from oscar.apps.basket import models
  287. basket = models.Basket.objects.get(id=1)
  288. basket.strategy = request.strategy
  289. With an assigned strategy class, a basket will raise a ``RuntimeError`` when
  290. attempting to calculate totals.
  291. The way a product is added to a basket has also been changed as a ``StockInfo``
  292. instance is also required.
  293. .. code-block:: python
  294. from oscar.apps.basket import models
  295. from oscar.apps.catalogue import models as product_models
  296. basket = models.Basket.objects.get(id=1)
  297. basket.strategy = request.strategy
  298. product = product_models.Product.objects.get(id=1)
  299. stockinfo = request.strategy.fetch(product)
  300. basket.