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
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.
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
* 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
With this change phone numbers (any qty) can be added as `ModelForm`
property `phone_numbers_fields` - dict where "keys" are names of
phone numbers fields and "values" are attributes of fields.
* `PhoneNumberMixin` clightly reworked and moved
from `oscar.views.generic` to `oscar.forms.mixins`
* Couple tests added (based on previous tests)
The idea of splitting integration from unittests is good in theory
but leads to a lot of mental overhead. Besides whenever a tests
interacts with a database it isn't a unittest anyway.
The tests were failing on python 2 due to the fact that the __init__.py
wasn't written so it wasn't a valid module. With this commit we now
also fully leverage pytest functionality to handle temporary paths for
us.
Add setting to allow SlugField and AutoSlugField accept unicode and automatically generate unicode-containing slugs.
Since there is no way to override SlugField and AutoSlugField in existing Oscar models, it was decided to pass `allow_unicode` parameter if this setting enable. This allows to achieve backwards compatibility with Django versions under 1.9, when this parameter was not supported yet. If parameter specified in the field expliticly - we do not override it, which allow to control slug fields individually in a normal way. For the reasons, explained above, standard SlugField was replaced with a custom one with the single slight change - control over `allow_unicode` parameter by the mentioned setting.
The tests check if the year 2010 is a valid option but since only the
last 5 years are rendered this is no longer the case. For now I've
changed the tests to check if 2014 is valid which should be the case the
next few years. A better option is to use the `freezegun` module in the
future.