Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

v0.6.rst 35KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  1. =======================
  2. Oscar 0.6 release notes
  3. =======================
  4. :release: 2014-01-08
  5. It took a while but it's finally here: welcome to Oscar 0.6!
  6. These release notes cover the `new features`_ as well as `backwards incompatible changes`_
  7. that you'll want to be aware of when upgrading from Oscar 0.5 or
  8. earlier. This release contains some major changes to core APIs which means
  9. many old APIs are scheduled to be dropped - see the `deprecation plan`_ to avoid any
  10. nasty surprises.
  11. When upgrading your Oscar site, make sure you study both the `backwards
  12. incompatible changes`_ and the `deprecated features`_. If you encounter any
  13. undocumented issues, please let us know on the `mailing list`_.
  14. .. _`new features`: `What's new in Oscar 0.6?`_
  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. .. _`mailing list`: https://groups.google.com/forum/?fromgroups#!forum/django-oscar
  19. Table of contents:
  20. .. contents::
  21. :local:
  22. :depth: 1
  23. Overview
  24. ========
  25. The biggest change in Oscar 0.6 is the reworking of `pricing and availability`_, which
  26. builds on top of the change to allow `multiple stockrecords per product`_. The
  27. change is largely backwards compatible with the old system of "partner
  28. wrappers" but it is recommended to upgrade to the new system. Support for
  29. partner wrappers will be removed for Oscar 0.7.
  30. Oscar 0.6 also introduces better support for marketplace-like functionality
  31. with the so-called permission-based dashboard. It is now possible to give
  32. non-staff users access to a subset of the dashboard's views (products and
  33. orders) by setting the new ``dashboard_access`` permission.
  34. `Oscar now supports Django 1.5`_ and its custom user model. This has been only
  35. tested in the context of starting a new Oscar project with a custom model.
  36. Switching from a separate "profile" model to the new system is not recommended
  37. at this point.
  38. Oscar also supports Django 1.6 although this is considered experimental at this
  39. stage. It's possible there are still some incompatibilities that haven't been
  40. teased out just yet.
  41. Other notable new features include:
  42. * A feature-rich `demo site`_ that illustrates how Oscar can be customised. It
  43. uses several of Oscar's many extensions such as django-oscar-paypal_,
  44. django-oscar-datacash_ and django-oscar-stores_. It is intended as a
  45. reference site for Oscar.
  46. * `Partners can now have addresses`_.
  47. * `Customer wishlists`_. Customers can how add products to wishlists and
  48. manage them within their account section.
  49. * `New helper methods`_ in the ``EventHandler`` class for order processing.
  50. * `Reworked search app`_ with support for easy faceting.
  51. Also, to help justify Tangent's sponsorship of Oscar,
  52. a simple `tracking mechanism`_ has been introduced to keep track of which sites
  53. use Oscar.
  54. .. _`Oscar now supports Django 1.5`: `django_support`_
  55. .. _`Partners can now have addresses`: `Partner dashboard & addresses`_
  56. .. _`Customer wishlists`: `Wishlists`_
  57. .. _`New helper methods`: `Order processing changes`_
  58. .. _`tracking mechanism`: `Tracking Oscar sites`_
  59. What's new in Oscar 0.6?
  60. ========================
  61. Multiple stockrecords per product
  62. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  63. Products can now have multiple stockrecords rather than just one. This is a
  64. key structural change that paves the way for many advanced features.
  65. If a product can be fulfilled by multiple partners, a different stockrecord can
  66. be created for each partner. This is a common requirement for large-scale
  67. e-commerce sites selling millions of products that use many different
  68. fulfillment partners.
  69. It also allows better support for international sites as stockrecords can be
  70. created for partners in different countries, who sell in different currencies.
  71. See the `documentation on pricing and availability`_ for more details.
  72. .. warning::
  73. This changes means several APIs are `deprecated`_ as they assume there is only
  74. one stockrecord per product.
  75. .. _`deprecated`: `Features deprecated in 0.6`_
  76. .. _`documentation on pricing and availability`: topics/prices_and_availability
  77. Pricing and availability
  78. ~~~~~~~~~~~~~~~~~~~~~~~~
  79. When products can have many stockrecords, a process needs to be in place to
  80. choose which one is selected for a given customer and product. To handle this,
  81. a new "strategy" class has been introduced, responsible for selecting the appropriate
  82. stockrecord for a given customer and product.
  83. This change also paved the way for reworking how prices, taxes and availability
  84. are handled. Instead of using `"partner wrappers"`_, the strategy class is
  85. responsible for returning availability details and prices for a particular
  86. product. New classes known as pricing and availability policies are used to
  87. cleanly encapsulate this information.
  88. These changes allow Oscar to dynamically determine prices, partner and availability
  89. for a given customer and product. This enables several advanced features such as:
  90. * Fulfilling a product from the partner that offers the best margin.
  91. * Fulfilling a product from the partner geographically closest to the customer.
  92. * Automatically switching to a new partner when when stock runs out.
  93. * Supporting transactions in multiple currencies on the same site.
  94. * Supporting different tax treatments on the same site (eg UK VAT and US sales
  95. tax)
  96. * Having different pricing and availability policies for different customers.
  97. More generally, it provides a structure for customising how pricing,
  98. availability work on a per-customer basis. This gives a great deal of
  99. flexibility.
  100. See the guide to :doc:`prices and availability </topics/prices_and_availability>`
  101. for more information.
  102. Permission-based dashboard
  103. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  104. Three changes were necessary to better support marketplace scenarios within
  105. Oscar:
  106. * Oscar's core :class:`~oscar.core.application.Application` class now supports
  107. specifying permissions on a per-view basis. This is done via a new default
  108. decorator. Legacy behaviour is unchanged.
  109. * The dashboard's menus are now built dynamically. If the current user does
  110. not have access to some views in :ref:`OSCAR_DASHBOARD_NAVIGATION`, they will
  111. be omitted in the menu returned by
  112. :meth:`oscar.apps.dashboard.nav.create_menu`.
  113. * The index, catalogue and order dashboard views have been modified to allow
  114. access to non-staff users. See :doc:`the dashboard documentation </ref/apps/dashboard>` for details.
  115. * The relation :attr:`oscar.apps.partner.abstract_models.AbstractPartner.users` was not
  116. used by core Oscar prior 0.6. It is now used to model access for the
  117. permission-based dashboard.
  118. Payment models have abstract versions
  119. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  120. The models within the :doc:`payment app </ref/apps/payment>` have been split into abstract and
  121. concrete versions. This brings them inline with other Oscar apps and allows
  122. them to be customised in the normal way.
  123. Wishlists
  124. ~~~~~~~~~
  125. Wishlist functionality has finally landed. Signed in customers are now able to
  126. create multiple named wishlists and add products to them. There is a new
  127. section in the customer's account where wishlists can be managed.
  128. .. figure:: screenshots/0.6/wishlist-button.png
  129. *The add-to-wishlist button.*
  130. .. figure:: screenshots/0.6/wishlist-detail.png
  131. *Editing a wishlist*
  132. See the :doc:`wishlist documentation </ref/apps/wishlists>` for more details.
  133. Partner dashboard & addresses
  134. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  135. Partners can now have addresses. These are useful for US sales tax where tax
  136. calculations need to know the origin of a product being shipped.
  137. A dashboard to handle partners, their users and addresses has been added.
  138. Checkout
  139. ~~~~~~~~
  140. The :class:`~oscar.apps.checkout.views.PaymentDetailsView` checkout view has
  141. been restructured for flexibility. There is a new
  142. :meth:`~oscar.apps.checkout.views.PaymentDetailsView.build_submission` method
  143. which is responsible for building a dict of all data for passing to the
  144. ``submit`` method. This includes the shipping address and shipping method
  145. which were previously loaded indirectly within the ``submit`` method.
  146. .. warning::
  147. While not major, the changes to checkout are backwards incompatible. See the
  148. :ref:`backwards compatibility notes <checkout_incompatibilities>` for more details.
  149. Demo site
  150. ~~~~~~~~~
  151. Oscar now ships with a demo site along side the sandbox site. While the sandbox
  152. is a minimal Django project that uses Oscar with all its defaults, the demo site
  153. is a more realistic example of an Oscar project. It has a custom skin and makes
  154. many alterations to the default Oscar behaviour.
  155. It's features include:
  156. * A range of different product types: books, downloads, clothing
  157. * PayPal Express integration using django-oscar-paypal_
  158. * Datacash integration using django-oscar-datacash_
  159. .. _django-oscar-paypal: https://github.com/tangentlabs/django-oscar-paypal
  160. .. _django-oscar-datacash: https://github.com/tangentlabs/django-oscar-datacash
  161. .. _django-oscar-stores: https://github.com/tangentlabs/django-oscar-stores
  162. See the :doc:`sandbox and demo site documentation </internals/sandbox>` for more details. A publicly accessible version of the demo site
  163. is available at http://demo.oscarcommerce.com.
  164. .. _django_support:
  165. Django 1.5, 1.6 and custom user model support
  166. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  167. Oscar now supports Django 1.5 and, experimentally, 1.6.
  168. Specifically, Oscar supports `custom user models`_, the headline new feature in Django
  169. 1.5. These can be used standalone or with a one-to-one profile model: Oscar's
  170. account forms inspect the model fields to dynamically pick up the fields for
  171. editing and display.
  172. There are some restrictions on what fields a custom user model must have. For
  173. instance, Oscar's default auth backend requires the user model to have an email
  174. and password field. New Oscar projects are encouraged to use the provided
  175. abstract user model as the base for their users.
  176. Support for Django 1.6 is considered experimental at the moment as there hasn't
  177. been time to run thorough tests for all possible incompatibilities.
  178. Further reading:
  179. * :doc:`How to use a custom user model </howto/use_a_custom_user_model>`.
  180. .. _`custom user models`: https://docs.djangoproject.com/en/dev/topics/auth/customizing/#specifying-a-custom-user-model
  181. .. _`documentation on user models`: https://docs.djangoproject.com/en/dev/topics/auth/customizing/#specifying-a-custom-user-model
  182. Accounts
  183. ~~~~~~~~
  184. The views and templates of the accounts section have been reworked to be clearer
  185. and easier to extend. There is no longer a generic frontpage for the accounts
  186. section - instead, each subsection has its own page. The navigation has also
  187. moved to the left-hand side.
  188. .. figure:: screenshots/0.6/account.png
  189. *The new-look account section with navigation on the left-hand side.*
  190. Bootstrap-WYSIHTML5 replaced by TinyMCE
  191. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  192. `TinyMCE 4.0`_ is now used in the dashboard for all textareas with class
  193. ``wysiwyg``. This has better browser support and is easier to customise than
  194. bootstrap-wysihtml5 (which has now been removed).
  195. It is easy to configure or replace with the HTML editor of your choice.
  196. .. figure:: screenshots/0.6/tinymce.png
  197. *Textarea with class ``wysiwyg`` now use TinyMCE.*
  198. .. _`TinyMCE 4.0`: http://www.tinymce.com/
  199. Improved address fields
  200. ~~~~~~~~~~~~~~~~~~~~~~~
  201. The postcode and phone number fields have been improved.
  202. * The postcode field is now validated in the model's
  203. :meth:`~oscar.apps.address.abstract_models.AbstractAddress.clean` method to
  204. ensure it is valid for the selected country.
  205. * The phone number field now uses a specialist
  206. :class:`~oscar.models.fields.PhoneNumberField` field class
  207. which validates and cleans the phone number.
  208. Better bankcard handling
  209. ~~~~~~~~~~~~~~~~~~~~~~~~
  210. In 0.5, there were two classes that representing a bankcard. These have been
  211. merged - the new version is
  212. :class:`~oscar.apps.payment.abstract_models.AbstractBankcard`.
  213. An instance of this model is returned by the :attr:`~oscar.apps.payment.forms.BankccardForm.bankcard`` property.
  214. Customer-facing range pages
  215. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  216. Ranges can now be flagged as public which means they get a customer-facing
  217. detail page which shows a range description and allows its products to be
  218. browsed.
  219. In the dashboard, the display order of the range's products can be controlled.
  220. To this end, the core :class:`~oscar.apps.offer.models.Range` model has been
  221. extended with a HTML description field.
  222. .. figure:: screenshots/0.6/range_detail.png
  223. *A customer-facing range page*
  224. Reworked search app
  225. ~~~~~~~~~~~~~~~~~~~
  226. Oscar's search app has been reviewed and simplified. The main view class
  227. (now :class:`~oscar.apps.search.views.FacetedSearchView`)
  228. has been reworked to provide better support for faceting, which can be easily
  229. specified using the :ref:`oscar_search_facets` setting.
  230. The ``SuggestionsView`` has been removed as it wasn't being used. A later
  231. version of Oscar will include a replacement.
  232. See the :doc:`search app documentation </ref/apps/search>` for more details.
  233. Order processing changes
  234. ~~~~~~~~~~~~~~~~~~~~~~~~
  235. The core :class:`~oscar.apps.order.processing.EventHandler` class has been
  236. extended.
  237. * The ``handle_shipping_event`` method now validates a proposed shipping event
  238. before saving it.
  239. * The ``handle_payment_event`` method now validates a proposed payment event
  240. before saving it.
  241. See the :class:`~oscar.apps.order.processing.EventHandler` for the available
  242. methods.
  243. Tracking Oscar sites
  244. ~~~~~~~~~~~~~~~~~~~~
  245. Oscar's dashboard now serves a single pixel image from one of Tangent's
  246. servers. This is included to gather information on which sites use Oscar,
  247. which is an important metric for Tangent, who sponsor Oscar's development.
  248. It can easily be disabled by setting ``OSCAR_TRACKING=False``. If you do opt
  249. out, please email the mailing list with any production Oscar sites you are
  250. running. This will help to ensure investment in Oscar's future.
  251. Minor changes
  252. ~~~~~~~~~~~~~
  253. * detox_ is a new dependency, which allows running `tox` tests in parallel.
  254. .. _detox: https://pypi.python.org/pypi/detox
  255. * ``OSCAR_ALLOW_ANON_REVIEWS`` has been a documented setting since Oscar 0.4.
  256. But there's never been any code to support this, which has been rectified with
  257. this release. Things should now work as expected.
  258. * Oscar uses a cookie to display recently displayed products. This cookie never
  259. expired and wasn't a ``HttpOnly`` cookie. It is now a ``HttpOnly`` cookie and expires
  260. after 7 days. Additionally, two settings have been introduced to configure
  261. it analogues to the basket cookies:
  262. ``OSCAR_RECENTLY_VIEWED_COOKIE_LIFETIME`` and
  263. ``OSCAR_RECENTLY_VIEWED_COOKIE_NAME``.
  264. Backwards incompatible changes in 0.6
  265. =====================================
  266. There were quite a few backwards incompatible changes in Oscar 0.6. There
  267. shouldn't be quite as many in future Oscar releases as we approach 1.0.
  268. Additional apps
  269. ~~~~~~~~~~~~~~~
  270. Four new apps are required in your ``INSTALLED_APPS``:
  271. .. code-block:: python
  272. INSTALLED_APPS = (
  273. ...
  274. 'oscar.apps.wishlists',
  275. 'oscar.apps.dashboard.pages',
  276. 'oscar.apps.dashboard.partners',
  277. 'oscar.apps.dashboard.reviews',
  278. ...
  279. )
  280. If you are using the ``get_core_apps`` helper function, then these new apps
  281. will be added automatically. The new wishlists app contains database migrations,
  282. so you will need to run the ``migrate`` management command.
  283. .. _checkout_incompatibilities:
  284. Checkout app
  285. ~~~~~~~~~~~~
  286. Several changes have been made to the checkout in the name of simplification
  287. and making things easier to customise.
  288. The ``PaymentDetailsView`` has been adjusted to explicitly pass variables
  289. around rather than relying on methods that load them on demand. This makes
  290. customisation easier and everything more explicit (a good thing).
  291. * The ``submit`` method in
  292. :class:`~oscar.apps.checkout.views.PaymentDetailsView` has a new signature.
  293. It now accepts the user, shipping address, shipping method and order total as
  294. required parameters The intention is that the ``build_submission`` methods
  295. returns a dict of kwargs for ``submit`` so that it can be called like::
  296. submission = self.build_submission()
  297. return self.submit(**submission)
  298. If your payment or order submission process requires additional parameters (eg
  299. a bankcard instance), override the ``build_submission`` method to provide them. The
  300. dict returned from the new ``build_submission`` method is also passed to the
  301. template.
  302. * The ``handle_payment`` method in
  303. :class:`~oscar.apps.checkout.views.PaymentDetailsView` now accepts a
  304. :class:`~oscar.core.prices.Price` instance instead of a Decimal for the order
  305. total.
  306. * The ``handle_order_placement`` method in
  307. :class:`~oscar.apps.checkout.mixins.OrderPlacementMixin`
  308. now accepts the user, shipping address and shipping method in a
  309. different order consistent with the ``submit`` method from
  310. ``PaymentDetailsView``.
  311. * The ``place_order`` method in
  312. :class:`~oscar.apps.checkout.mixins.OrderPlacementMixin`
  313. has a new signature. The parameters have been reordered and the shipping
  314. address, shipping method and billing address must be passed in explicitly (as
  315. unsaved instances).
  316. * The ``create_shipping_address`` method in
  317. :class:`~oscar.apps.checkout.mixins.OrderPlacementMixin` has changed
  318. signature. Instead of being passed a basket, it is now passed the user and
  319. an unsaved shipping address instance.
  320. * The ``create_billing_address`` method in
  321. :class:`~oscar.apps.checkout.mixins.OrderPlacementMixin` has changed
  322. signature. It is now passed an unsaved billing address instance as well as
  323. a shipping address instance.
  324. * The ``get_shipping_method`` (from
  325. :class:`~oscar.apps.checkout.session.CheckoutSessionMixin`) no longer
  326. defaults to returning free shipping if no shipping method can be looked up.
  327. * The :class:`~oscar.apps.checkout.calculators.OrderTotalCalculator` now
  328. returns a :class:`~oscar.core.prices.Price` instance from a new ``calculate``
  329. method. The old methods ``order_total_incl_tax`` and
  330. ``order_total_excl_tax`` have been removed.
  331. Other changes:
  332. * The checkout gateway page has a new option "Register and continue" which allows a customer
  333. to register before checking out. As part of this change, the option value ``new`` in
  334. ``GatewayForm`` has changed to ``guest`` as ``new`` option is used for this feature.
  335. * The checkout decorators ``basket_required`` and ``prev_steps_must_be_complete`` have been removed as they were
  336. no longer used.
  337. Shipping app changes
  338. ~~~~~~~~~~~~~~~~~~~~
  339. The default implementation of the
  340. :class:`~oscar.apps.shipping.repository.Repository` class
  341. has been adjusted to avoid thread-safety issues. If you define your own
  342. shipping ``Repository`` class, ensure that your shipping methods are
  343. instantiated per-request and not at compile time.
  344. For example, avoid this:
  345. .. code-block:: python
  346. from oscar.apps.shipping import repository
  347. class Repository(repository.Repository)
  348. # Don't instantiate at compile time!
  349. methods = [SomeMethod(), AnotherMethod()]
  350. Instead, instantiate the methods within ``get_shipping_methods``:
  351. .. code-block:: python
  352. from oscar.apps.shipping import repository
  353. class Repository(repository.Repository)
  354. # Note, methods are not instantiated. The get_shipping_methods
  355. # method will instantiate them.
  356. methods = [SomeMethod, AnotherMethod]
  357. .. warning::
  358. Beware of shipping methods that are configured via constructor parameters, like
  359. :class:`~oscar.apps.shipping.methods.FixedPrice`. If you are using methods
  360. that work this way, ensure you instantiate them at runtime.
  361. Shipping methods will be reworked for Oscar 0.7 to avoid these issues.
  362. Address model changes
  363. ~~~~~~~~~~~~~~~~~~~~~
  364. * The ``UserAddress.salutation`` and ``UserAddress.name`` methods are now
  365. properties.
  366. * The ``Country`` model's ``is_highlighted`` column has been renamed to
  367. ``display_order`` and is now an integer field to allow fine-grained country
  368. selection.
  369. Basket app changes
  370. ~~~~~~~~~~~~~~~~~~
  371. Several properties of the basket ``Line`` model have been renamed:
  372. * ``Line.line_price_excl_tax_and_discounts`` has been renamed to
  373. ``Line.line_price_excl_tax_incl_discounts``.
  374. * ``Line.line_price_incl_tax_and_discounts`` has been renamed to
  375. ``Line.line_price_incl_tax_incl_discounts``.
  376. The :func:`~oscar.templatetags.basket_tags.basket_form` templatetag has been
  377. altered to take the ``request`` as the first parameter, not ``request.basket``.
  378. Catalogue app changes
  379. ~~~~~~~~~~~~~~~~~~~~~
  380. 3 properties have been removed from
  381. :class:`oscar.apps.catalogue.abstract_models.AbstractProductImage` as they
  382. were unused: ``resized_image_url``, ``fullsize_url`` and ``thumbnail_url``.
  383. Thumbnailing is instead achieved in templates with Sorl.
  384. * The function ``add_category_from_breadcrumbs`` was not used and has been
  385. removed.
  386. * Alternative product class templates now use ``slug`` field instead of
  387. ``name.lower()`` to determine their filename. If you have templates for
  388. specific product classes, please update your filenames accordingly
  389. Customer app changes
  390. ~~~~~~~~~~~~~~~~~~~~
  391. The :class:`oscar.apps.customer.forms.EmailAuthenticationForm` form now needs to
  392. be instantated with a host name so prevent redirects to external sites.
  393. Offer app changes
  394. ~~~~~~~~~~~~~~~~~
  395. The ManyToManyField ``included_product`` of the
  396. :class:`~oscar.apps.offer.models.Range` model was changed to use ``through``
  397. relationship:
  398. * Use ``Range.add_product(product)`` instead of
  399. ``Range.included_product.add(product)``.
  400. * Use ``Range.remove_product(product)`` instead of
  401. ``Range.included_product.remove(product)``.
  402. When adding a product into a range, position in the range can be specified
  403. with ``display_order`` parameter:
  404. ``Range.add_product(product, display_order=3)``
  405. Payment app changes
  406. ~~~~~~~~~~~~~~~~~~~
  407. The balance method on the
  408. :class:`~oscar.apps.payment.abstract_models.AbstractSource` model is now a property, not a method.
  409. Reviews app changes
  410. ~~~~~~~~~~~~~~~~~~~
  411. The two product review forms, ``SignedInUserProductReviewForm`` and
  412. ``AnonymousUserProductReviewForm``, have been replaced by a new
  413. :class:`oscar.apps.catalogue.reviews.forms.ProductReviewForm`.
  414. Search app changes
  415. ~~~~~~~~~~~~~~~~~~
  416. Some of the names have been simplified.
  417. * The ``MultiFacetedSearchView`` and ``SuggestionsView`` view classes have been
  418. removed. The ``MultiFacetedSeachView`` class is replaced by ``FacetedSearchView``.
  419. * The ``MultiFacetedSearchForm`` has been removed in favour of
  420. ``SearchForm``.
  421. Loading baskets
  422. ~~~~~~~~~~~~~~~
  423. Now that products can have multiple stockrecords, several changes have been made
  424. to baskets to allow the appropriate stockrecord to be tracked for each basket
  425. line. The basket line model has a new field that links to the selected
  426. stockrecord and the basket itself requires an instance of the strategy class so
  427. that prices can be calculated for each line. Hence, if you loading baskets
  428. and manipulating baskets directly, you need to assign a strategy class in order
  429. for prices to calculate correctly:
  430. .. code-block:: python
  431. from oscar.apps.basket import models
  432. basket = models.Basket.objects.get(id=1)
  433. basket.strategy = request.strategy
  434. Without an assigned strategy class, a basket will raise a ``RuntimeError`` when
  435. attempting to calculate totals.
  436. Renamed templates
  437. ~~~~~~~~~~~~~~~~~
  438. Some templates have been renamed for greater consistency. If you are overriding
  439. these templates, ensure you rename your corresponding project templates.
  440. Many of the profile templates have been reorganised:
  441. * ``customer/address_list.html`` is renamed to
  442. ``customer/address/address_list.html``
  443. * ``customer/address_form.html`` is renamed to
  444. ``customer/address/address_form.html``
  445. * ``customer/address_delete.html`` is renamed to
  446. ``customer/address/address_delete.html``
  447. * ``customer/email.html`` is renamed to
  448. ``customer/email/email_detail.html``
  449. * ``customer/email_list.html`` is renamed to
  450. ``customer/email/email_list.html``
  451. * ``customer/order.html`` is renamed to
  452. ``customer/order/order_detail.html``
  453. * ``customer/order_list.html`` is renamed to
  454. ``customer/order/order_list.html``
  455. * ``customer/profile.html`` is renamed to
  456. ``customer/profile/profile.html``
  457. * ``customer/profile_form.html`` is renamed to
  458. ``customer/profile/profile_form.html``
  459. * ``customer/change_password_form.html`` is renamed to
  460. ``customer/profile/change_password_form.html``
  461. * ``partials/nav_profile.html`` has been removed.
  462. Template block changes
  463. ~~~~~~~~~~~~~~~~~~~~~~
  464. * The template ``dashboard/orders/order_detail.html`` has been reorganised. The
  465. ``tab_transactions`` block has been renamed to ``payment_transactions``.
  466. * In ``checkout/checkout.html``, the ``checkout-nav`` block has been renamed
  467. ``checkout_nav``.
  468. Changes to Partner permissions
  469. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  470. The following permissions on the
  471. :class:`~oscar.apps.partner.abstract_models.AbstractPartner` model were not
  472. used in Oscar and have been removed to avoid confusion with the newly
  473. introduced permission-based dashboard:
  474. * ``can_edit_stock_records``
  475. * ``can_view_stock_records``
  476. * ``can_edit_product_range``
  477. * ``can_view_product_range``
  478. * ``can_edit_order_lines``
  479. * ``can_view_order_lines``
  480. The permission-based dashboard introduced a new permission:
  481. * ``dashboard_access``
  482. Migrations
  483. ~~~~~~~~~~
  484. There are rather a lot of new migrations in Oscar 0.6. They are all detailed
  485. below.
  486. If you are upgrading and your project overrides one of these apps with
  487. new migrations, then ensure you pick up the schema changes in a new migration
  488. within your app. You can generally do this using ``manage.py schemamigration
  489. $APP --auto`` but check the corresponding core migration to ensure there aren't
  490. any subtleties that are being overlooked.
  491. Some of these migrations rename fields for consistency, while others ensure
  492. ``CharField`` fields are not nullable.
  493. * Address:
  494. - ``0003``: A new field ``display_order`` is added to the ``Country``
  495. model. This is the first of 3 migrations that replace the
  496. boolean ``is_highlighted`` field with an integer field that allows
  497. fine-grained control of the order of countries in dropdowns.
  498. - ``0004``: A data migration to ensure highlighted countries have a display
  499. order of 1.
  500. - ``0005``: Remove the ``is_highlighted`` field from the ``Country`` model
  501. as it is no longer necessary.
  502. - ``0006``: Add a uniqueness constraint across ``user_id`` and ``hash`` for
  503. the ``UserAddress`` model to prevent duplicate addresses.
  504. - ``0007``: Use a custom field for address postcodes.
  505. * Basket:
  506. - ``0004``: Add ``stockrecord`` field to the ``Line`` model to track which
  507. stockrecord has been selected to fulfill a particular line.
  508. - ``0005``: Add ``price_currency`` field to the ``Line`` model.
  509. * Catalogue:
  510. - ``0011``: Larger ``max_length`` on FileFields and ImageFields
  511. - ``0012``: Use ``NullBooleanField`` for the ``value_boolean`` field of
  512. the ``ProductAttributeValue`` model.
  513. - ``0013``: Add ``value_file`` and ``value_image`` fields to the
  514. ``ProductAttributeValue`` model to support file and image attributes.
  515. * Customer:
  516. - ``0005``: Don't allow ``sms_template`` field of
  517. ``CommunicationEventType`` model to be nullable.
  518. * Dashboard:
  519. - ``0002``: Don't allow ``error_message`` field of
  520. ``RangeProductFileUpload`` model to be nullable.
  521. * Offer app:
  522. - ``0020``: Data migration to set null offer descriptions to empty string.
  523. - ``0021``: Don't allow null offer descriptions or benefit types.
  524. - ``0022``: Add a ``slug`` field to the :class:`~oscar.apps.offer.models.Range` model.
  525. - ``0023``: A data migration to populate the new range slug field.
  526. - ``0024``: Add a ``is_public`` field to the :class:`~oscar.apps.offer.models.Range` model.
  527. - ``0025``: Add a ``description`` field to the :class:`~oscar.apps.offer.models.Range` model.
  528. - ``0026``: Add a ``applies_to_tax_exclusive_price`` field to
  529. ``ConditionalOffer`` model to try and handle offers that apply in bothe
  530. the US and UK (this field is later removed).
  531. - ``0027``: Create a joining table for the new M2M relationship between
  532. ranges and products.
  533. - ``0028``: Remove ``applies_to_tax_exclusive_price`` field.
  534. * Order app:
  535. - ``0010``: Allow postcodes for shipping- and billing addresses to be
  536. nullable.
  537. - ``0011``: Rename ``date`` field on ``CommunicationEvent``,
  538. ``ShippingEvent`` and ``PaymentEvent`` models to be ``date_created``.
  539. - ``0012``: Add ``reference`` field to ``PaymentEvent`` model.
  540. - ``0013``: Add a foreign key to ``ShippingEvent`` from ``PaymentEvent``
  541. model.
  542. - ``0014``: Change ``postcode`` field on ``ShippingAddress`` and
  543. ``BillingAddress`` models to use ``UppercaseCharField`` field.
  544. - ``0015``: Remove ``is_required`` and ``sequence_number`` fields from
  545. ``ShippingEventType`` and ``PaymentEventType`` models.
  546. - ``0016``: Add ``currency`` field to ``Order model``. Add a foreign key
  547. to the ``StockRecord`` model from the ``Line`` model.
  548. - ``0017``: Add a ``shipping_code`` field to the ``Order`` model.
  549. - ``0018``: ``ShippingAddress``'s ``phone_number`` is now a ``PhoneNumberField``
  550. to allow better validation.
  551. * Partner app:
  552. - ``0008``: Remove unnecessary ``partner_abstractstockalert`` table.
  553. - ``0009``: Create table for new ``PartnerAddress`` model.
  554. - ``0010``: Remove uniqueness constraint on ``product_id`` for the
  555. ``StockRecord`` model. This allows a product to have more than one
  556. stockrecord.
  557. * Payment app:
  558. - ``0002``: Ensure all ``CharField`` fields are not nullable. This
  559. migration handles both the data- and schema-migration in one.
  560. * Promotions app:
  561. - ``0002``: Ensure all ``CharField`` fields are not nullable.
  562. - ``0003``: Extend the ``max_length`` of the ``image`` field.
  563. * Wishlist app:
  564. - ``0001``: Initial table creation
  565. Features deprecated in 0.6
  566. ==========================
  567. Accessing a product's stockrecords
  568. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  569. Several properties and methods of the core
  570. :class:`~oscar.apps.catalogue.abstract_models.AbstractProduct` class have been
  571. deprecated following the change to allow multiple stockrecords per product.
  572. * The :attr:`~oscar.apps.catalogue.abstract_models.AbstractProduct.has_stockrecord` property
  573. no longer makes sense when there can be more than one stockrecord. It is
  574. replaced by
  575. :attr:`~oscar.apps.catalogue.abstract_models.AbstractProduct.has_stockrecords`
  576. * The :attr:`~oscar.apps.catalogue.abstract_models.AbstractProduct.stockrecord` property is
  577. deprecated since it presumes there is only one stockrecord per product.
  578. Choosing the appropriate stockrecord is now the responsibility of the
  579. :ref:`strategy class <strategy_class>`. A backward compatible version has
  580. been kept in place that selects the first stockrecord for a product. This
  581. will continue to work for sites that only have one stockrecord per product.
  582. All availability logic has been moved to :ref:`availability policies<availability_policies>`
  583. which are determined by the :ref:`strategy class <strategy_class>`.
  584. * The :attr:`~oscar.apps.catalogue.abstract_models.AbstractProduct.is_available_to_buy` property
  585. is deprecated. The functionality is now part of availability policies.
  586. * The :meth:`~oscar.apps.catalogue.abstract_models.AbstractProduct.is_purchase_permitted` method
  587. is deprecated. The functionality is now part of availability policies.
  588. Checkout session manager
  589. ~~~~~~~~~~~~~~~~~~~~~~~~
  590. The ``shipping_method`` method of the
  591. :class:`~oscar.apps.checkout.utils.CheckoutSessionData` is now deprecated in
  592. favour of using ``shipping_method_code``. It is being removed as the
  593. ``CheckoutSessionData`` class should only be responsible for retrieving data
  594. from the session, not loading shipping method instances.
  595. Checkout order placement mixin
  596. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  597. The following methods within
  598. :class:`~oscar.apps.checkout.mixins.OrderPlacementMixin` are deprecated as the
  599. flow of placing an order has been changed.
  600. * :meth:`~oscar.apps.checkout.mixins.OrderPlacementMixin.create_shipping_address_from_form_fields`
  601. * :meth:`~oscar.apps.checkout.mixins.OrderPlacementMixin.create_shipping_address_from_user_address`
  602. * :meth:`~oscar.apps.checkout.mixins.OrderPlacementMixin.create_user_address`
  603. Bankcard model
  604. ~~~~~~~~~~~~~~
  605. The :attr:`~oscar.apps.payment.abstract_models.AbstractBankcard.card_number`
  606. is deprecated in favour of using
  607. :attr:`~oscar.apps.payment.abstract_models.AbstractBankcard.number`.
  608. "Partner wrappers"
  609. ~~~~~~~~~~~~~~~~~~
  610. Before Oscar 0.6, availability and pricing logic was encapsulated in "partner
  611. wrappers". A partner wrapper was a class that provided availability and price
  612. information for a particular partner, as specified by the
  613. ``OSCAR_PARTNER_WRAPPERS`` setting. The stockrecord model had several
  614. properties and methods
  615. which delegated to the appropriate wrapper for the record's partner.
  616. This functionality is now deprecated in favour of using :ref:`strategy classes <strategy_class>`.
  617. How prices and taxes are determined is not generally a function of the partner,
  618. and so this system was not a good model. Strategy classes are much more
  619. flexible and allow better modelling of taxes and availability.
  620. The following properties and methods from :class:`~oscar.apps.partner.abstract_models.StockRecord`
  621. are deprecated and will be removed for Oscar 0.7. These are all convenience
  622. properties and methods that delegate to the appropriate partner wrapper.
  623. * :attr:`AbstractStockRecord.is_available_to_buy <oscar.apps.partner.abstract_models.AbstractStockRecord.is_available_to_buy>`
  624. * :meth:`AbstractStockRecord.is_purchase_permitted <oscar.apps.partner.abstract_models.AbstractStockRecord.is_purchase_permitted>`
  625. * :attr:`AbstractStockRecord.availability_code <oscar.apps.partner.abstract_models.AbstractStockRecord.availability_code>`
  626. * :attr:`AbstractStockRecord.availability <oscar.apps.partner.abstract_models.AbstractStockRecord.availability>`
  627. * :attr:`AbstractStockRecord.max_purchase_quantity <oscar.apps.partner.abstract_models.AbstractStockRecord.max_purchase_quantity>`
  628. * :attr:`AbstractStockRecord.dispatch_date <oscar.apps.partner.abstract_models.AbstractStockRecord.dispatch_date>`
  629. * :attr:`AbstractStockRecord.lead_time <oscar.apps.partner.abstract_models.AbstractStockRecord.lead_time>`
  630. * :attr:`AbstractStockRecord.price_incl_tax <oscar.apps.partner.abstract_models.AbstractStockRecord.price_incl_tax>`
  631. * :attr:`AbstractStockRecord.price_tax <oscar.apps.partner.abstract_models.AbstractStockRecord.price_tax>`
  632. All the above properties and methods have effectively been moved to the availability and pricing
  633. policies that a strategy class is responsible for loading. To upgrade your
  634. codebase, replace your partner wrapper classes with equivalent
  635. :doc:`availability and pricing policies </topics/prices_and_availability>`.
  636. Test support extension brought back into core
  637. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  638. The `Oscar test support library`_ has been ported back into Oscar core. This
  639. simplifies things and avoids circular dependency issues. If your project is
  640. using this extension, you should remove it as a dependency and use the
  641. analogous functionality from ``oscar/test/``.
  642. .. _`Oscar test support library`: https://github.com/tangentlabs/django-oscar-testsupport