Oscar already has child products to model tightly coupled products, and
"recommended products" to model products that are related (which we
expect to mostly be used for upselling). Product.related_products was a
third option that sat somewhere inbetween, and which I think will often
not be needed, has a mediocre interface in the dashboard and beyond that
no special treatment in the codebase. Furthermore, I see it being
confusing when trying to model a catalogue, and it's easily added back
if necessary.
It just duplicates ProductRecord.score, makes ``oscar_calculate_scores``
slow and generally serves no useful purpose.
Also included docs for the previous changse to
``oscar_calculate_scores``.
OSCAR_SLUG_FUNCTION: Support string notation to set slugifier
Importing things in settings is discouraged. But until now,
OSCAR_SLUG_FUNCTION could only be set as a callable, which requires
importing. It's now been updated to use the import_string function.
Add unique_together constraints to ManyToMany through models
Oscar uses explicit through-models for some ManyToMany relationships.
The expectation is that for each combinatination of the two foreign
keys, only one model can exist. But this hasn't been enforced until now.
Fixes #1309.
This completes the move away from partner wrappers to strategies. All
the methods for determining price and availability information have now
been removed from the partner classes.
The helper policy class ("DelegateToStockRecord") have been removed too
as they no longer have methods to call on the stockrecord.
This was meant to be added in 0.7, but forgotten. Now, the Python,
Django and Oscar version in use are reported if OSCAR_TRACKING is
enabled. This helps Tangent to make informed decisions about what
versions of Python and Django to support, and how long to maintain older
Oscar versions.
The recently introduced management command makes customising easier, and
the docs have been updated accordingly. The how-tos could still do with
updating to the new command, but at least the main docs are current.
This finishes the changes made in v0.6 where basket lines started
requiring a stockrecord FK. v0.7 handles the upgrade in middleware by
updating basket lines that didn't have a stockrecord. But since the
patch for v0.7 requires additional database queries, it's time to remove
it - which is what this change does.
This will be a slightly fiddly upgrade for some people as they will need
to run a data migration on their DB before applying the new basket
migration. I've included a sample snippet in the release notes which
should help.
[Backport] Docs: Fix formatting of command line instructions
Sphinx turned the double dash into a long dash. A user reported issues
with running the command after copy&pasting it.
(cherry picked from commit 90ab1f19f0)
Oscar is slowly adding better support for switching languages on the
fly. That also means that locales need to be switched.
The issue this commit tries to fix is that when switching languages, the
locale for rendering prices doesn't change, and hence prices are
formatted incorrectly.
Oscar used to require hardcoding the locale for prices via
OSCAR_CURRENCY_LOCALE. I'm not sure what the reasoning behind this was,
because as far as I'm aware, the locale can be auto-detected from the
current language. This not only reduces complexity, but nicely works
when switching languages.
Make proxy_class fields NullCharFields to avoid uniqueness issues
Django has issues with using blank=True and unique=True together on a
CharField, which is why we've introduced the NullCharField. A more
detailed description can be found in it's docstring.
The same problems apply to the proxy_class fields on offer models.
Switching them to NullCharFields should resolve the problem.
Also altered one check for proxy_class to be consistent with the other
checks for an empty proxy class.
Non-critical migration for CommunicationEventType.code
A check for outstanding migrations brought this up. Unfortunately I
can't find a way to instruct South to ignore the parameter. Model
introspection only allows setting what basically is fancy default
values. Parameters like help_text are ignored in South's
USELESS_PATTERNS, but can't be altered.
* Made upper_limit a DecimalField, like the other weight fields
* Increased default precision for weights to be to the gram level. Will
be useful for deployments shipping smaller items such as stickers,
where 10 grams precision is too low.
* Changed strings to official 'kg' abbreviation.
Rename and move Scales class, and make it overridable
Making it overridable allows altering the weighing method of the basket,
which I wanted to do in a project. As get_classes doesn't support
importing from top-level products, it had to be moved to a scales
module.
Other class names tend to use singular, so as the imports had to be
changed anyway, Scales was renamed to Scale.
[Backport] Allow unassigning categories from products
This has been impossible so far. It is easily achieved by setting
can_delete=True on the formset.
I spent some time trying to get the nice solution working, which would
be that assigning an empty category means deleting that ProductCategory
instance. But I haven't found a good solution that avoids problems like
in #1267. I have since come to the conclusion that enabling can_delete
is the right thing to do. One can then explicitly hide the checkbox,
but set the correct hidden field in Javascript on the client side if
an empty value is assigned.
The fields section has been moved from the factory declaration to the
ProductForm Meta class to allow for easier customisation.
Fixes #1289
(cherry picked from commit 3e4c2f73dd)
This has been impossible so far. It is easily achieved by setting
can_delete=True on the formset.
I spent some time trying to get the nice solution working, which would
be that assigning an empty category means deleting that ProductCategory
instance. But I haven't found a good solution that avoids problems like
in #1267. I have since come to the conclusion that enabling can_delete
is the right thing to do. One can then explicitly hide the checkbox,
but set the correct hidden field in Javascript on the client side if
an empty value is assigned.
The fields section has been moved from the factory declaration to the
ProductForm Meta class to allow for easier customisation.
Fixes #1289
Extend tracker pixel to include Python and Django version
Reasoning about e.g. when it is feasible to drop Python 2.6 or Django
1.5 support is hard without reliable data, hence the tracker pixel has
been extended to submit the Python and Django version in use. Tracking
is still easily disabled by setting OSCAR_TRACKING to False.
This Javascript plugin was used to style browser scrollbars in a
cross-platform way. I belief it's better to remove it:
a) It doesn't do anything, at least on my Ubuntu Chrome nor Firefox.
b) I'm sure there's decent reasons why there isn't a cross-platform
way to style scrollbars. It's a liability when it comes to smartphones
and tables, because those scrollbars use a different UI.
c) It's easy to add back again if so desired.
Add support for i18n_patterns and enable for sandbox
This required:
* Moving Django's i18n urls into the main urls.py and outside of the
scope of Oscar's main application class, because they need to live
outside of the scope of i18n_patterns
* Add a language-code stripped version of the current URL to the
template context to get the language switcher working.
I also updated the language switcher code to mimic what is currently
given as an example in Django's docs.
Fixes #797
It is now replaced with a checkout pre-condition that applies to every
checkout view. If someone's basket becomes invalid while they are in
checkout, then they will be redirected back to the basket page.
Data and schema migrations for removing null=True on CharFields
The data migrations convert any field values that are None to ''.
After second thought, the field changes on ProductAttributeValues have
been undone again. It seems more consistent with the other fields.