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.

v3.0.rst 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. =======================
  2. Oscar 3.0 release notes
  3. =======================
  4. :release: 2021-01-27
  5. Welcome to Oscar 3.0!
  6. This is a significant release, in which all of Oscar's core templates and styles have
  7. been ported to Bootstrap 4. Support for Bootstrap 3 has been dropped, and projects that upgrade to Oscar 3 will
  8. also need to upgrade their frontend and dashboard templates to use Bootstrap 4.
  9. .. contents::
  10. :local:
  11. :depth: 1
  12. .. _compatibility_of_3.0:
  13. Compatibility
  14. ~~~~~~~~~~~~~
  15. Oscar 3.0 is compatible with Django 2.2, Django 3.0 and Django 3.1 as well as Python 3.6, 3.7 and 3.8.
  16. Support for Django 1.11 and Django 2.1 has been dropped. Support for Python 3.5 has been dropped.
  17. .. _new_in_3.0:
  18. What's new in Oscar 3.0?
  19. ~~~~~~~~~~~~~~~~~~~~~~~~
  20. - Oscar 3.0 features a major upgrade of Oscar's default templates and styles to use Bootstrap version 4.5.
  21. Both the front-end and dashboard templates have been refactored to work with Bootstrap 4. This is a major,
  22. non-backward compatible change for projects that rely on or extend the default Oscar templates.
  23. The Bootstrap 4 `migration guide <https://getbootstrap.com/docs/4.5/migration/>`_ is a helpful resource for
  24. migration from version 3.
  25. - As with Bootstrap 4 itself, Oscar's default styles are now defined using SASS instead of LESS.
  26. - To replace Bootstrap 3's Glyphicons, Oscar's default templates now rely on `Font Awesome <https://fontawesome.com/>`_.
  27. - Support was added to the ``catalogue.Option`` model to define the
  28. type of option. This is used by the ``AddToBasketForm`` to determine the appropriate form field to display for that
  29. option in the add-to-cart form. Currently supported types are: text, integer, float, boolean, and date.
  30. The ``type`` field on the ``Option`` model (previously used to denote whether the option is required)
  31. has been repurposed to store the type of the option, and a new ``required`` field
  32. has been added to denote whether the option is required. Projects that have forked the catalogue app will
  33. need to generate custom migrations for these model field changes.
  34. Projects should pay close attention to the data migration provided in
  35. ``catalogue/migrations/0019_option_required.py`` for this change.
  36. - Added support for restricted combinations of offers. When creating an offer in the dashboard,
  37. administrators can now define a restricted set of other offers that offer can be used in combination with.
  38. This changes introduces a new ``combinations`` field on the ``Offer`` model which requires a database migration.
  39. - The base ``ReportGenerator`` class has been refactored to make it easier to use. Subclasses must now define
  40. either a ``model_class`` or ``queryset`` to indicate which model/queryset the report generator should use, or
  41. alternatively override the ``get_queryset()`` method. Failure to do one of these will result in an exception.
  42. - Filtering by date range is now properly applied during CSV export of reports.
  43. - New fields ``meta_title`` and ``meta_description`` have been added to both the ``Product`` and ``Category`` models,
  44. which can be used to override the HTML title and meta description content for product and category pages. These
  45. are editable from the search engine optimisation tab in the dashboard edit views for products and categories
  46. respectively. A database migration is required for this change.
  47. Backwards incompatible changes
  48. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49. - The ``StockRecord.price_excl_tax`` field has been renamed to ``StockRecord.price``.
  50. Projects that have forked the ``partner`` app will need to generate their own migration
  51. to rename this field.
  52. - The ``annotate_form_field`` template tag will now set the ``widget_type`` in `the format used by Django 3.1`_: so no longer
  53. ``CheckboxInput``, but just ``checkbox``.
  54. - The signature of the ``shipping_discount`` methods on ``Offer`` and ``Benefit`` has changed to accept an optional
  55. ``currency`` argument, which is now supplied when calling those methods. This allows currency-aware determination
  56. of shipping discounts.
  57. - The signature of the ``Benefit.round`` method has changed to accept an optional ``currency`` argument, which is now
  58. supplied when calling those methods. The currency is also passed to any custom rounding function
  59. that is defined using ``OSCAR_OFFER_ROUNDING_FUNCTION``. This allows currency-aware rounding.
  60. .. _`the format used by Django 3.1`: https://docs.djangoproject.com/en/3.1/ref/forms/api/#django.forms.BoundField.widget_type
  61. Bug fixes
  62. ~~~~~~~~~
  63. - ``catalogue.product_attributes.ProductAttributesContainer`` was refactored to ensure that attributes
  64. inside the container are always properly loaded at initialisation. The container is now wrapped in a
  65. ``SimpleLazyObject`` when assigned to ``Product.attr``. ``ProductAttributesContainer.initiate_attributes()``
  66. was removed as the database query now happens on instantiation.
  67. - Fixed the handling of multiple non-exclusive offers with a count condition (:issue:`3162`).
  68. Removal of deprecated features
  69. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  70. - Several deprecated model fields have been removed in Oscar 3.0:
  71. - ``order.Line.est_dispatch_date``
  72. - ``order.Line.unit_cost_price``
  73. - ``order.Line.unit_retail_price``
  74. - ``partner.StockRecord.cost_price``
  75. - ``partner.StockRecord.price_retail``
  76. Oscar ships with migrations that remove these fields. If you want to continue using them,
  77. please make sure you add the fields back to your forked app before migrating. Projects
  78. that have forked the ``order`` and ``partner`` apps will need to generate their own
  79. migrations to remove these fields.
  80. - ``customer.notifications.services.notify_user`` and ``customer.notifications.services.notify_users``
  81. have been removed. Use ``communication.utils.Dispatcher.notify_user`` and
  82. Use ``communication.utils.Dispatcher.notify_users`` respectively instead.
  83. - ``customer.alerts.utils.send_alerts``, ``customer.alerts.utils.send_alert_confirmation`` and
  84. ``customer.alerts.utils.send_product_alerts`` have been removed.
  85. Use ``customer.alerts.utils.AlertsDispatcher.send_alerts``,
  86. ``customer.alerts.utils.AlertsDispatcher.send_product_alert_confirmation_email_for_user`` and
  87. ``customer.alerts.utils.AlertsDispatcher.send_product_alert_email_for_user``
  88. respectively instead.
  89. - The ``CommunicationEventType``, ``Email`` and ``Notification`` models that moved from the ``customer`` app to the ``communication`` app in Oscar 2.1 can no longer be dynamically loaded from their old paths.
  90. Minor changes
  91. ~~~~~~~~~~~~~
  92. - Several models were updated to define a default ordering, to avoid issues with inconsistent ordering of
  93. items in the dashboard and elsewhere. Database migrations are required for these changes. Models affected are:
  94. - ``analytics.UserProductView``
  95. - ``analytics.UserSearch``
  96. - ``catalogue.Option``
  97. - ``communication.CommunicationEventType``
  98. - ``communication.Email``
  99. - ``customer.ProductAlert``
  100. - ``offer.Range``
  101. - ``order.OrderDiscount``
  102. - ``order.OrderNote``
  103. - ``payment.Source``
  104. - ``payment.SourceType``
  105. - ``voucher.VoucherSet``
  106. - ``voucher.Voucher``
  107. - ``voucher.VoucherApplication``
  108. - Database indexes were added to several model fields to improve query efficiency. Affected fields are:
  109. - ``catalogue.Option.name``
  110. - ``communication.CommunicationEventType.name``
  111. - ``customer.ProductAlert.date_created``
  112. - ``payment.SourceType.name``
  113. - ``voucher.VoucherSet.date_created``
  114. - ``voucher.Voucher.date_created``
  115. - ``voucher.VoucherApplication.date_created``
  116. - Category slugs can now be edited via the dashboard.
  117. - A new method ``get_attribute_values()`` was added to the Product model which returns a merged set of
  118. attribute values for child and parent products.
  119. - The behaviour of ``checkout.views.ThankYouView`` when no order is found in the session has changed,
  120. to redirect the user to the URL defined by ``settings.OSCAR_HOMEPAGE`` instead of returning a page not found error.
  121. Dependency changes
  122. ~~~~~~~~~~~~~~~~~~
  123. Python package dependencies:
  124. - Upgraded ``django-tables2`` to version 2.3.
  125. Javascript and CSS dependencies:
  126. - Upgraded ``bootstrap`` to version 4.5.3.
  127. - Added ``tempusdominus-bootstrap-4`` version 5.1, use for Bootstrap 4 datepicker inputs.
  128. - Upgraded ``tinymce`` to version 5.6.
  129. .. _deprecated_features_in_3.0:
  130. Deprecated features
  131. ~~~~~~~~~~~~~~~~~~~
  132. - The ``catalogue.Option.is_required`` is deprecated. Check ``Option.required`` instead.