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.
Extend docs on application instances and customising them
Understanding the application tree these days is only necessary when
wanting to change URLs or views. Hence, it's been moved from the
customising doc and reworked into the how-to. This reduced some
considerable duplication and hopefully makes the customisation section
clearer.
Docs: Remove how-tos on customising mixins and overriding core class
These days, to override a mixin it is only required to override the
OrderPlacementMixin; overriding the app and view is not necessary. It is
just a generic case of overriding a core class. A dedicated how-to is
thus unnecessary.
As overriding a core class is the general goal of any advanced
customisation, it has been merged into the customisation section, which
has been given an overhaul as well.
The section regarding modifying apps will be re-added as part of a
higher-level "the Oscar application tree" kind of document.
The getting started guide now explicitly mentions copying the "missing
image" image when working with a remote file storage. Was raised in
issue #1314.
[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.
Several of Oscar dependencies don't support Windows, some of them don't
work at all. Added a warning that indicates installing Oscar on Windows
is a tricky process.
This allows importing a class or attribute by the reasonably common
string notation, which is useful for e.g. settings. When using settings,
we should prefer absolute imports over using get_class, because that
limits us to modules in INSTALLED_APPS.
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.
Remove useless entropy-increasing calls of django.conf.urls.patterns
The function essentially does two things:
1. it applies a prefix - the first argument - to the given urls. In no
instance a prefix was given
2. it calls url() for simple tuple or list elements in the given iterable.
Cases where such a tuple or list was passed to patterns have been
replaced by direct calls to url()
2 allowed for both calls to url() and simple tuples to be listed in
get_urls() and similar places. This allowed for unnecessary variation.
Always calling url() makes the url lists look less noisy and more uniform,
allowing the reader to focus on the actual differences of the urls instead
of superfluities.
django.conf.urls.patterns will also undergo deprecation starting from
Django 1.8. This commit anticipates that change.
https://docs.djangoproject.com/en/dev/releases/1.8/#django-conf-urls-patterns