Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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