您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

v0.6.rst 35KB

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