Improve efficiency of Range.product_queryset when fetching matching child products (#3734)
* Improve efficiency of Range.product_queryset when fetching matching child products.
* Add tests to verify that contains_product returns true for child products whose parent is in a range.
Make fixes for deprecations in Django 3.2 and Python
- Add new "DEFAULT_AUTO_FIELD" Django 3.2 setting
- Fix deprecated (in "gettext") use of non-int numbers for selecting
plural translations
- Provide "get_response" callable when creating middleware-factory
instance in tests
Fix saving of Benefit/Condition "proxy_class" field in dashboard OfferWizardStepView
- This uses a simpler and more robust way to get the list of fields to
serialise for storage in the session
- "custom_benefit" and "custom_condition" were unused, as they aren't
fields of any of the serialised models
- Also remove unused parameter in
"dashboard.offers.views.OfferWizardStepView._fetch_form_kwargs"
- allow creation of offers of all types
- allow creation of vouchers with multiple offers
- allow creation of voucher sets of all usages, and with multiple offers
Issue: https://github.com/django-oscar/django-oscar/issues/3162
* Checking of `offer.benefit.max_affected_items` removed from the
`available` method of `LineOfferConsumer` class - available items should
not be limited by related benefit (it should be considered when applying
the offer).
* Improved `apply` method of `PercentageDiscountBenefit` - affected
items must include "quantities with discount applied".
* `is_satisfied` method of `CountCondition` updated to pass `offer`
instead of `None` to `line.quantity_without_offer_discount` - this
change is required to fix the initial issue.
* Updated `test_available_with_offer` test - initially this test was
added to check the lines that we removed from the `available` method of
`LineOfferConsumer` class (See fda27a183d/).
* Added tests to confirm that the initial issue is fixed.
Fix rendering of upsell messages for exclusive offers (#3548)
* Improve `available` method of `LineOfferConsumer` class
* Add `quantity_available_for_offer` method to `AbstractLine` class
* Improve conditions: "Get num matches" methods updated to use `quantity_available_for_offer`
method of `Line` model.
* Improve conditions: `get_upsell_message` methods updated to show upsell message only in
the cases where `delta` > 0.
* Ensure basket upsell messages are not `None`
Use function as the return value of `get_url_decorator`. This change
needed because `get_url_decorator` method of `OscarConfigMixin` class
returns function or `None` and not string.