Registering receivers is a tricky business pre-Django 1.7 as they get
registered at the same time when models get registered, but require the
sending model to already be in the app cache. It's surprising we don't
see more issues!
Recommendations:
* Avoid calls to get_model in modules that get called during app init at
all cost
* Don't use get_model in your own code. Just import directly.
* Switch to Django 1.7 :)
This commit probably fixes the issue in #1205. But get_model calls to
fetch the category, product image and stock record will all fail,
because receivers listen to their signals.
This commit also moves the catalogue receiver into it's own receivers
module, because that's how we do it elsewhere. That won't make a
difference to the issues though.
A custom app needs to inherit from Oscar's app config. This ensures the
correct app label, and that any startup code (receivers, etc.) is
executed.
Per the camp ground rule, the fork_app command has been slightly
refactored.
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.
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.
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
Replace session_strategy template tag with purchase_info_for_product in demo-site temaplates and doc. See https://github.com/tangentlabs/django-oscar/commit/a8a140fa94baa13f778f9a1529de8d5c2b75e3f2
Replace stockrecord_tags with purchase_info_tags in demo-site templates and docs as invented in oscar0.6. See https://github.com/tangentlabs/django-oscar/commit/6341b576bf9fa18c4dc1c78aaa88e174826763f6
The customisation section required some changes as it's not often
necessary to override the root application instance to change URLs or
views of subapps.
The mailing list raised the issue of having to include the models.py to
replace a Form. The docs weren't clear, so I've taken the opportunity
to:
* merge 'INSTALLED_APPS' section and 'models.py & admin.py'.
* change misc wordings and add clarifications
Attempt at making it clearer what needs to be done for what kind of
customisation. Created a new topic that lines out the prepatory
steps that need to be taken, and moved duplicate information from the
how-tos into the new topic.
The old howto included out-dated info on how to translate Oscar. That
has been replaced by a link to the Transifex project.
It was the only howto left under the Contributing headline, which really
shouldn't be there (as there's an entirely different section in the docs
for contributing). As it is more of a topic anyway, and will hopefully
soon include documentation on translation style etc., it was turned into
a topic.
To set a base for upcoming docs changes, the docs directory structure
has been streamlined to follow a simplified version of Django's docs.
The old _draft folder has been removed. Both files from there and the
current docs that don't fit nicely into the new structure are in _old/
for the moment.