Optimize Range queries for contains_product() and all_products()
Optimize Range queries for contains_product() and all_products()

Cache the categories, so a range can be tested against a set of products
without refetching the categories all the time.

Also avoid querying product.get_product_class() as the Range.classes is
typically empty (it's not exposed in the Oscar dashboard interface).
It could even avoid another query if there was an API like
product.get_product_class_id() but this could cause compatibility problems for
projects that override product.get_product_class()

The range.all_products() uses range._category_ids() which performed 2 queries
where it only needs one, and can now reuse cached data.

Calling range.is_reorderable also fetched unneeded children, but this was
hidden in the RangeProductListView due to the reuse of cached data.

django-oscar/django-oscar,solarissmoke/django-oscar,django-oscar/django-oscar,solarissmoke/django-oscar,solarissmoke/django-oscar,sasha0/django-oscar,sasha0/django-oscar,sasha0/django-oscar,django-oscar/django-oscar,solarissmoke/django-oscar,django-oscar/django-oscar,sasha0/django-oscar