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.
Decouple price and availability in base strategies.
Revert changes in #1913 and #2294 that required a stock record to have price_excl_tax set in order to report the product as available.
Add separate checks to the basket form/add logic that checks at the time of
adding a product to the basket whether a price exists, and report an error if it doesn't.
Fixes #2664.
Add backward compatible order verification hash checking.
This can be enabled by specifying a `OSCAR_DEPRECATED_ORDER_VERIFY_KEY` setting, which is not set by default.
This allows projects to continue validating old order verification hashes while still changing the `SECRET_KEY`.
during development of large ecommerce site we ran into an exception
when accessing the list of offers and ranges:
AttributeError 'NoneType' object has no attribute 'paginator'
django_rangepaginator/templatetags/rangepaginator.py in paginate at line 12
This PR fixes all cases I could find where this happens, but chances are
some views need the same fix.
- split out the queryset filters into separate methods for easy overloading
in subclasses, i.e. have the keyword search in product titles as well.
- cleanup the get_date_from_to_queryset method a little to make it more dry.
- expand test-coverage for the affected code.
There is a subtle change in behaviour here. Null is converted to ''
only when reading the field value from the database. Previously
this was done in the to_python method, but this causes problems
with uniqueness validation.
Distinguish active address fields definition and address hash generation in order to avoid hashing breaking when active address fields property is customized.
Do not perform stock allocation manipulations on non-stock-tracked products (#2567)
* Silently skip stock allocation manipulations if the product class doesn't track stock.
* Make it possible to cancel/consume stock allocations without line args.
You can now do:
consume_stock_allocations(order)
cancel_stock_allocations(order)
without the lines / line_quantities arguments.
Fix `ExtendedURLValidator` for locale-prefixed URLs for locales, different the current.
Previously, validation did not pass when current locale is "en-gb" and URL is "/de/catalogue/" and visa versa due to default Django URL resolvers behaviour - they do not take into account all locales, only current.
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)