Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

v2.1.rst 9.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. =======================
  2. Oscar 2.1 release notes
  3. =======================
  4. :release: 2020-07-10
  5. Welcome to Oscar 2.1! This is a significant release which includes a number of
  6. new features and performance improvements.
  7. .. contents::
  8. :local:
  9. :depth: 1
  10. .. _compatibility_of_2.1:
  11. Compatibility
  12. ~~~~~~~~~~~~~
  13. Oscar 2.1 is compatible with Django versions 2.2 and 3.0, and Python versions 3.5, 3.6, 3.7 and 3.8.
  14. Support for Django versions 1.11 and 2.0 has been dropped.
  15. .. _new_in_2.1:
  16. What's new in Oscar 2.1?
  17. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. - The ability to add arbitrary surcharges to orders (e.g., a processing fee for
  19. a particular payment method) was introduced.
  20. See :ref:`how_to_surcharges` for details on how to configure this.
  21. This change requires a database migration.
  22. - The database performance of ``offer.Range.all_products()`` was substantially
  23. improved. The internals of that method have changed and specifically
  24. ``Range.invalidate_cached_ids()`` has been removed and replaced with
  25. ``Range.invalidate_cached_queryset()``.
  26. - The ``upload_to`` argument of image fields in Oscar's ``ProductImage`` and
  27. ``ProductAttributeValue`` models was changed to use a callable, so that
  28. Django doesn't generate migrations if a project modifies the ``OSCAR_IMAGE_FOLDER``
  29. to specify a custom directory structure for uploaded images.
  30. This change requires a database migration.
  31. - ``catalogue.Category`` now has an ``is_public`` boolean field that serves a
  32. similar purpose to ``catalogue.Product.is_public`` - i.e., to hide categories
  33. public views. The ``Category`` model also now has a custom manager
  34. that provides a ``browsable()`` queryset method that excludes non-public
  35. categories. This change requires a database migration.
  36. Category hierarchy implies that the children of any non-public category are
  37. also non-public. This is enforced through an ``ancestors_are_public`` field
  38. on the ``Category`` model.
  39. - A ``date_updated`` field was added to the ``basket.Line`` model, which is updated
  40. every time a line is saved. This change requires a database migration.
  41. Communications app
  42. ------------------
  43. A new ``communication`` app was introduced to provide a single point of entry
  44. for all communications sent by Oscar. This is a significant change with implications
  45. as follows:
  46. - Projects will need to add
  47. ``oscar.apps.communication.apps.CommunicationConfig`` to ``INSTALLED_APPS``.
  48. The ``CommunicationEventType``, ``Email`` and ``Notification`` models have
  49. moved from the ``customer`` app to the ``communication`` app. In order to
  50. preserve existing data, the table names for these models are unchanged.
  51. This change requires a database migration.
  52. - The ``Dispatcher`` class moved from ``customer.utils`` to
  53. ``communication.utils``. ``Dispatcher`` is now responsible for sending
  54. all notifications, and not just emails.
  55. - A ``CustomerDispatcher`` utility class that wraps the core ``Dispatcher``
  56. has been introduced to the ``customer`` app for sending communications to
  57. customers.
  58. - An ``AlertsDispatcher`` utility class that wraps the core ``Dispatcher``
  59. has been introduced to the ``customer.alerts`` module for sending product
  60. alerts.
  61. - An ``OrderDispatcher`` utility class that wraps the core ``Dispatcher``
  62. has been introduced to the ``order`` app for sending order related
  63. communications.
  64. - A new setting, ``OSCAR_SAVE_SENT_EMAILS_TO_DB`` controls whether emails
  65. sent through the ``Dispatcher`` are saved to the database. This defaults
  66. to ``True``.
  67. - The ability to send multipart emails with attachments was added to the new
  68. dispatcher.
  69. - All communication email templates (``commtype_*``) have moved from
  70. moved from ``customer/emails`` to ``communication/emails``.
  71. - Templates in ``customer/email/`` and ``customer/notification/`` have moved
  72. to ``communication/email/`` and ``communication/notification/``.
  73. - An ``absolute_url`` template tag was introduced to facilitate generating
  74. absolute URLs in templates for a given domain and path. The schema for
  75. generated URLs is configured via the ``OSCAR_URL_SCHEMA`` setting, which defaults
  76. to ``http``.
  77. Backwards incompatible changes in Oscar 2.1
  78. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  79. - The ``category`` field has been removed from the
  80. ``communication.Notification`` model. This change requires database migration.
  81. - The ``checkout.mixins.OrderPlacementMixin.send_confirmation_message``
  82. method has been replaced with a new ``send_order_placed_email`` method.
  83. - ``customer.notifications.context_processors.notifications`` has moved to
  84. ``communication.notifications.context_processors.notifications``.
  85. Bug fixes
  86. ~~~~~~~~~
  87. - Fixed a bug in the handling of requests to save an item in the basket for
  88. later(:issue:`3215`).
  89. - Fixed an error when deleting an offer whose related conditions/benefits have
  90. been deleted.
  91. - Fixed handling of count conditions in ``MultibuyDiscountBenefit``.
  92. Previously, when a count condition was used with this benefit it would result
  93. in a discount being applied for all items in the basket rather than the
  94. cheapest one.
  95. - Fixed a bug where a line could not be deleted from the basket, if the basket
  96. had another line with a validation error - i.e. its product was out of stock
  97. (see :issue:`2791` and :issue:`1654`).
  98. - Fixed a bug where non-public child products were not excluded from parent product
  99. forms and detail views.
  100. Removal of deprecated features
  101. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  102. - Support for verifying order hashes using an insecure MD5 algorithm generated
  103. by Oscar 1.5 and below has been dropped. The ``OSCAR_DEPRECATED_ORDER_VERIFY_KEY``
  104. setting is no longer used. Order verification hashes generated by Oscar 1.5
  105. and lower will no longer validate.
  106. - ``offer.Range.contains()`` has been removed. Use ``contains_product()`` instead.
  107. - ``catalogue.managers.ProductManager`` has been removed. Use
  108. ``catalogue.managers.ProductQuerySet.as_manager()`` instead.
  109. - ``catalogue.managers.BrowsableProductManager`` has been removed. Use
  110. ``Product.objects.browsable()`` instead.
  111. - ``catalogue.Product.browsable`` has been removed. Use
  112. ``Product.objects.browsable()`` instead.
  113. - Invalid URLs supplied to ``OSCAR_DASHBOARD_NAVIGATION`` are no longer ignored.
  114. URLs that cannot be resolved will now result in a ``NoReverseMatch`` exception.
  115. URLs that are not provided by a subclass of ``oscar.core.application.OscarDashboardConfig``
  116. will result in a ``KeyError``.
  117. - ``customer.forms.PasswordResetForm.get_reset_url`` has been removed.
  118. - The internal and undocumented class ``oscar.core.compat.UnicodeCSVReader``
  119. has been removed. Use ``csv.reader`` instead.
  120. Minor changes
  121. ~~~~~~~~~~~~~
  122. - ``OrderPlacementMixin.place_order`` now ignores inactive vouchers when placing
  123. an order (instead of raising an exception), for consistency with how
  124. the basket flows handle inactive vouchers.
  125. - Fixed the logic of ``StockRequired.parent_availability_policy`` to use
  126. child products to determine availability of children, rather than the parent.
  127. - ``customer.forms.PasswordResetForm`` now uses the parent class' ``get_users()``
  128. method to determine the list of users to send an email to. ``get_users()``
  129. filters out users who do not currently have a usable password - which
  130. did not happen previously.
  131. This change was made in response to changes in Django to address
  132. CVE-2019-19844. Oscar's ``PasswordResetForm`` was not vulnerable to the issue
  133. in Django's form, but it was possible to send a password reset email to
  134. unintended recipients because of unicode character collision.
  135. - ``catalogue.Product.is_public`` is now an indexed field. This change requires
  136. a database migration.
  137. - When a voucher that was created through the Oscar dashboard is deleted, the
  138. auto-generated offer that was created with the voucher is also deleted.
  139. - Fixed the ``brand_title`` block in ``partials/brand.html`` so that it doesn't span unclosed HTML tags.
  140. - ``customer.views.ProfileUpdateView.form_valid`` was modified
  141. to use a new ``send_email_changed_email`` method.
  142. - ``customer.views.ChangePasswordView.form_valid`` was modified
  143. to use a new ``send_password_changed_email`` method.
  144. - A ``public`` method was added to the ``ProductQuerySet``, which filters on products with ``is_public=True``.
  145. Dependency changes
  146. ~~~~~~~~~~~~~~~~~~
  147. Python package dependencies:
  148. - Upgraded ``pillow`` to version 6.0.0 or higher.
  149. - Upgraded ``django-extra-views`` to version 0.13.
  150. - Upgraded ``django-haystack`` to version 3.0 or higher.
  151. - Upgraded ``django-phonenumber-field`` to version 3.0.
  152. - Upgraded ``django-tables2`` to version 2.2.
  153. - Upgraded ``sorl-thumbnail`` (optional requirement) to version 12.6.
  154. - Upgraded ``easy-thumbnails`` (optional requirement) to version 2.7.
  155. Javascript dependencies:
  156. - Upgraded ``jquery`` to version 3.5.
  157. - Upgraded ``inputmask`` to version 5.0.
  158. - Upgraded ``select2`` to version 4.0.
  159. - Upgraded ``tinymce`` to version 5.3.
  160. .. _deprecated_features_in_2.1:
  161. Deprecated features
  162. ~~~~~~~~~~~~~~~~~~~
  163. - ``customer.alerts.utils.send_alerts`` is deprecated.
  164. Use ``AlertsDispatcher.send_alerts`` instead.
  165. - ``customer.alerts.utils.send_alert_confirmation`` is deprecated.
  166. Use ``AlertsDispatcher.send_product_alert_confirmation_email_for_user``
  167. instead.
  168. - ``customer.alerts.utils.send_product_alerts`` is deprecated.
  169. Use ``AlertsDispatcher.send_product_alert_email_for_user`` instead.
  170. - ``customer.notifications.services.notify_user`` is deprecated.
  171. Use Dispatcher.notify_user``.
  172. - ``customer.notifications.services.notify_users`` is deprecated.
  173. Use ``Dispatcher.notify_users`` instead.