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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. =======================
  2. Oscar 2.0 release notes
  3. =======================
  4. :release: tbd
  5. Welcome to Oscar 2.0
  6. Table of contents:
  7. .. contents::
  8. :local:
  9. :depth: 1
  10. .. _compatibility_of_2.0:
  11. Compatibility
  12. -------------
  13. Oscar 2.0 is compatible with Django 1.11, Django 2.0 and Django 2.1 as well as
  14. Python 3.5 and 3.6.
  15. Support for Python 2.7 and Python 3.4 has been dropped.
  16. .. _new_in_2.0:
  17. What's new in Oscar 2.0?
  18. ------------------------
  19. - Added an ``is_public`` field to the ``Product`` model that is used to exclude products from the
  20. ``browsable`` queryset. A ``browsable_dashboard`` queryset is provided for use in the dashboard, which includes non-public products.
  21. This is a model change that requires database migration.
  22. - Added an ``order.OrderStatusChange`` model that is used to log order status changes
  23. applied by ``Order.set_status()``. This is a new model which will require database migrations to be applied.
  24. - Added an ``OSCAR_OFFERS_INCL_TAX`` setting which can be used to configure whether
  25. offer discounts are applied on the tax-inclusive amount. This defaults to ``False``,
  26. to preserve the original behaviour of discount application.
  27. - Added database index definitions for commonly queried fields in a range of models. See `#2875`_.
  28. This will require projects that have forked Oscar apps to generate corresponding migrations.
  29. - Added a ``filter_by_attributes`` method on the ``ProductQuerySet``,
  30. to allow database-level filtering of products by attribute.
  31. .. _`#2875`: https://github.com/django-oscar/django-oscar/pull/2875
  32. Removal of deprecated features
  33. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. - Support for deprecated product alert email templates was removed The templates
  35. for these emails have been replaced as follows:
  36. - ``customer/alerts/emails/confirmation_subject.txt`` is replaced by
  37. ``customer/emails/commtype_product_alert_confirmation_subject.txt``
  38. - ``customer/alerts/emails/confirmation_body.txt`` is replaced by
  39. ``customer/emails/commtype_product_alert_confirmation_body.txt``
  40. - ``customer/alerts/emails/alert_subject.txt`` is replaced by
  41. ``customer/emails/commtype_product_alert_subject.txt``
  42. - ``customer/alerts/emails/alert_body.txt`` is replaced by
  43. ``customer/emails/commtype_product_alert_body.txt``
  44. Product alert emails are now sent as Communication Events.
  45. - Support for category URLs without a primary key was removed.
  46. Enforcement of unique slugs for categories was also removed, as enforcing
  47. this was inefficient and not threadsafe. Since a primary key is now required
  48. for category URLs, there is no need for slugs to be unique.
  49. - ``customer.forms.SetPasswordForm`` and ``customer.forms.PasswordChangeForm``
  50. have been removed. Use ``django.contrib.auth.forms.SetPasswordForm`` and
  51. ``django.contrib.auth.forms.PasswordChangeForm`` instead.
  52. - The ``views.decorators.staff_member_required`` decorator has been removed. Use
  53. ``permissions_required(['is_staff']`` instead.
  54. - The ``UserAddress.num_orders`` property has been removed. Use
  55. ``num_orders_as_shipping_address`` and ``num_orders_as_billing_address``
  56. instead.
  57. - Backward-compatible dynamic loading of formset classes that have moved in Oscar was
  58. removed. Projects must update their ``get_class`` calls to use the new paths.
  59. The paths that have changed are as follows:
  60. ================================ ================================== ================
  61. Old path New path Affected classes
  62. ================================ ================================== ================
  63. ``basket.forms`` ``basket.formsets`` ``BaseBasketLineFormSet``
  64. ``BasketLineFormSet``
  65. ``BaseSavedLineFormSet``
  66. ``SavedLineFormSet``
  67. ``dashboard.catalogue.forms`` ``dashboard.catalogue.formsets`` ``BaseStockRecordFormSet``
  68. ``StockRecordFormSet``
  69. ``BaseProductCategoryFormSet``
  70. ``ProductCategoryFormSet``
  71. ``BaseProductImageFormSet``
  72. ``ProductImageFormSet``
  73. ``BaseProductRecommendationFormSet``
  74. ``ProductRecommendationFormSet``
  75. ``ProductAttributesFormSet``
  76. ``wishlists.forms`` ``wishlists.formsets`` ``LineFormset``
  77. ================================ ================================== ================
  78. - Added the ability to manage ``catalogue.Option`` objects from the dashboard.
  79. Minor changes
  80. ~~~~~~~~~~~~~
  81. - Dropped ``action=""`` and ``action="."`` attributes, following the lead of Django
  82. and as per the HTML5 specification.
  83. - Replaced use of Django's procedural auth views with the corresponding
  84. class-based views.
  85. - ``OrderPlacementMixin.get_message_context()`` is now passed a ``code`` argument
  86. specifying the communication event type code for a message being sent.
  87. - We've dropped the dependency on Unidecode due to license incompatibilities,
  88. ``oscar.core.utils.default_slugifier`` now uses ``oscar.core.utils.cautious_slugify``
  89. to handle unicode characters in slugs when ``OSCAR_SLUG_ALLOW_UNICODE`` is ``False``.
  90. - ``OSCAR_SLUG_FUNCTION`` previously accepted a function as its value. It now
  91. only accepts a dotted path to a function as its value. Such functions must
  92. also now take a ``allow_unicode`` kwarg.
  93. - Fixed input validation for ``dashboard.offers.forms.BenefitForm`` when a ``range``
  94. was specified but other fields were empty.
  95. - Fixed calculation of weight-based shipping charges in cases where the basket
  96. weight is an exact multiple of a weight band's upper limit.
  97. - The ``sort_by`` field on ``catalogue.reviews.SortReviewsForm`` was made optional
  98. and the logic in ``ProductReviewList`` adjusted so that the form fields
  99. don't have to be rendered manually because of form errors.
  100. - Added a ``datetime_filters`` tag library that provides a ``timedelta`` template
  101. filter for rendering time deltas in human readable format.
  102. - ``OSCAR_OFFER_ROUNDING_FUNCTION`` previously accepted a function as its value. It now
  103. only accepts a dotted path to a function as its value
  104. - Fixed the logic of ``offers.Range.all_products()`` to make it consistent with
  105. ``Range.contains_product()`` in excluding products specified in ``excluded_product_ids``.
  106. - Added a ``COMPARISON_FIELDS`` constant to ``catalogue.Category`` to restrict
  107. which fields are fetched from the database when performing category comparison queries.
  108. - Significantly improved the database efficiency of the ``category_tree`` template tag.
  109. - Order confirmation emails now include an order status link for authenticated users, as well as guest users, and order status is displayed consistently in both logged-in and anonymous order detail views.
  110. - Fixed display of styled HTML emails in account email detail views, wrapping them in an iframe to avoid leakage of styles into the page.
  111. - Bootstrap datetime picker JS/CSS assets removed from base layout, see :issue:`2584`.
  112. - Oscar's 500 error template no longer inherits other templates and
  113. does not use any template template tags and
  114. styling to avoid potential errors caused by the template itself (see :issue:`2971`).
  115. .. _incompatible_in_2.0:
  116. Backwards incompatible changes in Oscar 2.0
  117. -------------------------------------------
  118. - Redirection to the parent detail view for child products is disabled by default.
  119. Child products now have their own detail view, which allows displaying their price
  120. and images independently from the parent product. To revert to the previous behaviour
  121. of redirecting to the parent product, set
  122. ``oscar.apps.catalogue.views.ProductDetailView.enforce_parent`` to ``False``.
  123. - Renamed the modules containing the Django app config classes for Oscar apps
  124. (apart from the ``oscar`` app), from ``config`` to ``apps``.
  125. - Removed the ``app`` modules of Oscar apps, moving the configs (related to
  126. permissions, URLconfs, and feature hiding) they contained into the apps'
  127. Django app config classes. They include the following attributes: ``name``
  128. (since renamed ``namespace``), ``login_url``, ``hidable_feature_name``,
  129. ``permissions_map``, and ``default_permissions``; methods:
  130. :meth:``get_urls``, :meth:``post_process_urls``, :meth:``get_permissions``,
  131. :meth:``get_url_decorator``, and :meth:``urls``; and their respective view
  132. classes. The composite config classes for normal Oscar apps are subclasses of
  133. ``oscar.core.application.OscarConfig`` (previously
  134. ``oscar.core.application.Application``), and for Oscar Dashboard apps
  135. ``oscar.core.application.OscarDashboardConfig`` (previously
  136. ``oscar.core.application.DashboardApplication``).
  137. - Removed the ``application`` variable, which previously held an Oscar app
  138. config instance, from the Oscar app config module. A single Django/Oscar app
  139. config instance is now registered in the Django app registry, for each app
  140. label. It should be obtained by looking it up in the Django app registry.
  141. - Changed the values returned by the Oscar app config ``urls`` property. It now
  142. returns a tuple containing the list of URL patterns, the app namespace (which
  143. could previously be None, but not any more), and the instance namespace
  144. (which would previously be overiden by the app namespace, if left blank, but
  145. must now be explicitly set). To include URLs with an instance namespace, use
  146. the form ``app_config.urls``, and to include URLs without an instance
  147. namespace, use the form ``django.conf.urls.include(app_config.urls[0])``.
  148. - Removed :meth:``oscar.get_core_apps``. Overridding apps is now done by
  149. replacing the Oscar app entry in the ``INSTALLED_APPS`` setting with that of
  150. the forked app.
  151. - Changed the calling signature for the ``oscar_fork_app`` management command.
  152. The ``app_label`` argument is the Django app label of the app to be forked.
  153. ``target_path`` is the directory into which the new app shall be copied.
  154. ``new_app_subpackage`` is the optional dotted path to the subpackage of the
  155. new app, from which, together with the ``target_path``, the full Python path
  156. to the app will be derived. If a ``new_app_subpackage`` is omitted, then the
  157. subpackage of the app being forked will be used instead.
  158. - Promotions application completely removed from the Oscar core and dashboard
  159. and will be available as external application - `django_oscar_promotions`_.
  160. .. _`django_oscar_promotions`: https://github.com/django-oscar/django-oscar-promotions
  161. Migrating forked apps
  162. ~~~~~~~~~~~~~~~~~~~~~
  163. - For each forked app:
  164. - Rename the module that contains the Django app config class, from
  165. ``config.py`` to ``apps.py``.
  166. - Change the ``default_app_config`` variable in the ``__.init__.py`` module to
  167. point to the new Django app config class.
  168. - Change the Django app config class's inheritance base class to the one in
  169. the parent app's ``apps`` module (it should be a
  170. ``oscar.core.application.OscarConfig`` or
  171. ``oscar.core.application.OscarDashboardConfig`` subclass).
  172. - Move the Oscar app configs from the ``oscar.core.application.Application``
  173. or ``oscar.core.application.DashboardApplication`` subclass in its
  174. ``app.py`` module, to the corresponding
  175. ``oscar.core.application.OscarConfig`` or
  176. ``oscar.core.application.OscarDashboardConfig`` subclass in the ``apps.py``
  177. module.
  178. - These include the following overridden attributes:
  179. - Rename ``name`` to ``namespace``
  180. - ``login_url``
  181. - ``hidable_feature_name``
  182. - ``permissions_map``
  183. - ``default_permissions``
  184. - These include the following overridden methods:
  185. - :meth:``get_urls``
  186. - :meth:``post_process_urls``
  187. - :meth:``get_permissions``
  188. - :meth:``get_url_decorator``
  189. - :meth:``urls``
  190. - For URLconfs that include Oscar app URLs (e.g. in the ``dashboard`` app):
  191. - Obtain the app's Django/Oscar app config instance from the Django app
  192. registry, instead of from the app's previous config module's (``app.py``)
  193. ``application`` variable.
  194. - If the to-be-included URLs have an instance namespace, use the form
  195. ``app_config.urls``, which passes in the list of URL patterns, the app
  196. namespace, and the instance namespace.
  197. - If the to-be-included URLs do not have an instance namespace, use the
  198. form ``include(app_config.urls[0])``, which only passes in the list of
  199. URL patterns.
  200. - For the main app's URLconf:
  201. - Obtain the ``oscar`` app's Django/Oscar app config instance from the Django
  202. app registry, instead of from the previous config module's (``config.py``)
  203. ``application`` variable.
  204. - Include the ``oscar`` app's URLs using the form
  205. ``include(app_config.urls[0])``, to only pass in the list of URL patterns,
  206. and not an app or instance namespace.
  207. Dependency changes
  208. ------------------
  209. - Upgraded TinyMCE to version 4.8.3.
  210. - Upgraded jQuery inputmask to version 4.0.2.
  211. .. _deprecated_features_in_2.0:
  212. Deprecated features
  213. ~~~~~~~~~~~~~~~~~~~
  214. - ``offer.Range.contains()`` is deprecated. Use ``contains_product()`` instead.
  215. - ``catalogue.managers.ProductManager`` is deprecated.
  216. Use ``catalogue.managers.ProductQuerySet.as_manager()`` instead.
  217. - ``catalogue.managers.BrowsableProductManager`` is deprecated.
  218. Use ``Product.objects.browsable()`` instead.