When looking up a URL for a forked app, the previous mechanism fetched the top level AppConfig which allows every user.
The new mechanism creates a dict of dashboard URLs/configs and does a lookup to find a DashboardConfig.
This will also raise NoReverseMatch if the URL does not exist or is not a dashboard URL.
fix https://github.com/django-oscar/django-oscar/issues/3080
Retrieving product options now performs only 1 query. (#3037)
* Retrieving product options now performs only 1 query.
Also it returns all the product options combined. This makes more sense because
as the existing tests prove, there is already a way to retrieve the product_class
options and the product options separately.
* Implement basic abstract thumbnails generator backend
* Create `oscar_thumbnail` template tag in `image_tags`
* Add `easy_thumbnails` to `INSTALLED_APPS` in sandbox settings
* Modify `primary_image` method of `Product` model
* Override in templates Sorl's `thumbnail` tag with `oscar_thumbnail` tag
* Check that related module is installed during thumbnail class initialization
* Add params to `original` field of `ProductImageFactory`
* Add media related URLs to test settings
* Add unit tests for thumbnailer backend
* Create test helpers in `test/utils`
These helpers will be used in tests related to thumbnails
* Add tests to check `oscar_thumbnail` template tag
* Add test to check images/thumbnails deleted for deleted product
* Move `sorl-thumbnail` and `easy-thumbnails` to `extras_require`
With this change these packages can be installed as
* `pip install django-oscar[sorl-thumbnail]`
* `pip install django-oscar[easy-thumbnails]`
* Updated "Template tags" section in docs with info about `oscar_thumbnail`
* Describe `OSCAR_THUMBNAILER` setting in "Settings" section of the docs
* Add information about created thumbnail backend to the release notes
- Move Oscar app configs into Django app config classes
- Rename Oscar/Django apps' app config module
- Remove "oscar.get_core_apps()" and its app overriding
- Remove "oscar.OSCAR_CORE_APPS"
- Port app forking code to work with Django app registry
- Port class loading code to use app configs to get app properties
Fix Range.all_products() inconsistency with contains_product()
This change fixes the inconsistency with range.all_products() which
didn't check for exclusions when includes_all_products is set
Every other bit of oscar expected range.includes_all_products means
that all products are included, no questions asked. The dashboard
interface even hides the option to edit/remove individual products.
The short circuiting in ConditionalOffer.products() is removed so
the range.all_products() logic is applied consistently.
Fix validation of required phone_number field in PhoneNumberMixin.
If a phone_number field is required, and empty, then PhoneNumberMixin.clean() fails with a key error because the field does not exist in cleaned_data.
This patch fixes the clean() method to only attempt to clean a field if it exists in cleaned_data. If it doesn't then allow Django to raise a validation error for a missing required field.
Also added more comprehensive tests for the validation logic in the mixin.