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

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